Skip to content

Commit ddeb29f

Browse files
authored
fix(ui): issue with thumbnail component crashing the UI if the image didnt exist (#10689)
1 parent 7f8f2f0 commit ddeb29f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/ui/src/elements/Thumbnail/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ export function ThumbnailComponent(props: ThumbnailComponentProps) {
9292
}
9393
}, [fileSrc])
9494

95+
let src: string = ''
96+
9597
/**
9698
* If an imageCacheTag is provided, append it to the fileSrc
9799
* Check if the fileSrc already has a query string, if it does, append the imageCacheTag with an ampersand
98100
*/
99-
const queryChar = fileSrc.includes('?') ? '&' : '?'
100-
const src = imageCacheTag ? `${fileSrc}${queryChar}${imageCacheTag}` : fileSrc
101+
if (fileSrc) {
102+
const queryChar = fileSrc?.includes('?') ? '&' : '?'
103+
src = imageCacheTag ? `${fileSrc}${queryChar}${imageCacheTag}` : fileSrc
104+
}
101105

102106
return (
103107
<div className={classNames}>

0 commit comments

Comments
 (0)