File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ import { getInt } from '../utils/helpers';
8
8
import { uploadcareLoader } from '../utils/loader' ;
9
9
10
10
const shouldOverrideBlurDataUrl = ( props : ImageProps ) : boolean => {
11
- return props . placeholder === 'blur' && ! props . blurDataURL ;
11
+ return (
12
+ typeof props . src === 'string' &&
13
+ props . placeholder === 'blur' &&
14
+ ! props . blurDataURL
15
+ ) ;
12
16
} ;
13
17
14
18
const generateBlurDataUrl = (
@@ -27,15 +31,11 @@ const generateBlurDataUrl = (
27
31
} ;
28
32
29
33
export function UploadcareImage ( props : ImageProps ) : JSX . Element {
30
- let blurDataURL : string | undefined ;
31
- if ( typeof props . src === 'string' && shouldOverrideBlurDataUrl ( props ) ) {
32
- blurDataURL = generateBlurDataUrl ( props . src , props . width ) ;
34
+ let blurDataURL = props . blurDataURL ;
35
+ if ( shouldOverrideBlurDataUrl ( props ) ) {
36
+ blurDataURL = generateBlurDataUrl ( props . src as string , props . width ) ;
33
37
}
34
38
return (
35
- < Image
36
- loader = { uploadcareLoader }
37
- blurDataURL = { blurDataURL ?? props . blurDataURL }
38
- { ...props }
39
- />
39
+ < Image loader = { uploadcareLoader } blurDataURL = { blurDataURL } { ...props } />
40
40
) ;
41
41
}
You can’t perform that action at this time.
0 commit comments