File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
packages/core/components/FileList Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -65,14 +65,18 @@ export default function LazilyRenderedThumbnail(props: LazilyRenderedThumbnailPr
6565 const [ thumbnailPath , setThumbnailPath ] = React . useState < string | undefined > ( ) ;
6666 const [ isLoading , setIsLoading ] = React . useState ( true ) ;
6767
68+ // Rough estimate of pixels to render for generating zarr thumbnails
69+ // Use a semi consistent value to avoid excessive network calls
70+ // (e.g., should not re-render for every window resize)
71+ const targetZarrSize = 500 / fileGridColCount ; // 100px for large thumbnails, and 50px for small thumbnails
6872 React . useEffect ( ( ) => {
6973 if ( file ) {
70- file . getPathToThumbnail ( undefined ) . then ( ( path ) => {
74+ file . getPathToThumbnail ( targetZarrSize ) . then ( ( path ) => {
7175 setThumbnailPath ( path ) ;
7276 setIsLoading ( false ) ;
7377 } ) ;
7478 }
75- } , [ file ] ) ;
79+ } , [ file , targetZarrSize ] ) ;
7680
7781 const onClick = ( evt : React . MouseEvent ) => {
7882 evt . preventDefault ( ) ;
You can’t perform that action at this time.
0 commit comments