File tree Expand file tree Collapse file tree 1 file changed +2
-13
lines changed
Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change @@ -33,25 +33,14 @@ export const ImageThumbnail = memo(({
3333 fallback,
3434} : ImageThumbnailProps ) => {
3535 const [ thumbnailData , setThumbnailData ] = useState < ThumbnailData | null > ( null )
36- const [ isLoading , setIsLoading ] = useState ( true )
37- const [ error , setError ] = useState ( false )
3836
3937 useEffect ( ( ) => {
4038 let cancelled = false
4139
4240 const loadThumbnail = async ( ) => {
43- setIsLoading ( true )
44- setError ( false )
45-
4641 const data = await extractThumbnailColors ( imagePath , width , height )
47-
4842 if ( ! cancelled ) {
49- if ( data ) {
50- setThumbnailData ( data )
51- } else {
52- setError ( true )
53- }
54- setIsLoading ( false )
43+ setThumbnailData ( data )
5544 }
5645 }
5746
@@ -62,7 +51,7 @@ export const ImageThumbnail = memo(({
6251 }
6352 } , [ imagePath , width , height ] )
6453
65- if ( isLoading || error || ! thumbnailData ) {
54+ if ( ! thumbnailData ) {
6655 return < > { fallback } </ >
6756 }
6857
You can’t perform that action at this time.
0 commit comments