Skip to content

Commit ffa535e

Browse files
committed
fix(tooltip): add preload=none and handle query strings in video detection
1 parent b467d75 commit ffa535e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apps/sim/components/emcn/components/tooltip/tooltip.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ const VIDEO_EXTENSIONS = ['.mp4', '.webm', '.ogg', '.mov'] as const
116116
* ```
117117
*/
118118
const Preview = ({ src, alt = '', width = 240, height, className }: PreviewProps) => {
119-
const isVideo = VIDEO_EXTENSIONS.some((ext) => src.toLowerCase().endsWith(ext))
119+
const pathname = src.toLowerCase().split('?')[0].split('#')[0]
120+
const isVideo = VIDEO_EXTENSIONS.some((ext) => pathname.endsWith(ext))
120121

121122
return (
122123
<div className={cn('mt-[4px] overflow-hidden rounded-[3px]', className)}>
@@ -130,6 +131,7 @@ const Preview = ({ src, alt = '', width = 240, height, className }: PreviewProps
130131
loop
131132
muted
132133
playsInline
134+
preload='none'
133135
aria-label={alt}
134136
/>
135137
) : (

0 commit comments

Comments
 (0)