File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ const SingleProduct: React.FC<IProductRootObject> = ({ product }) => {
11
11
12
12
const placeholderFallBack = 'https://via.placeholder.com/600' ;
13
13
14
- let DESCRIPTION_WITHOUT_HTML : string | undefined ;
14
+ let DESCRIPTION_WITHOUT_HTML : string | null = null ;
15
15
16
16
useEffect ( ( ) => {
17
17
setIsLoading ( false ) ;
@@ -28,11 +28,10 @@ const SingleProduct: React.FC<IProductRootObject> = ({ product }) => {
28
28
if ( regularPrice ) regularPrice = paddedPrice ( regularPrice , 'kr' ) ;
29
29
if ( salePrice ) salePrice = paddedPrice ( salePrice , 'kr' ) ;
30
30
31
- if ( typeof window !== 'undefined' ) {
32
- DESCRIPTION_WITHOUT_HTML = new DOMParser ( ) . parseFromString (
33
- description ,
34
- 'text/html' ,
35
- ) . body . textContent ;
31
+ if ( typeof window !== 'undefined' && description ) {
32
+ DESCRIPTION_WITHOUT_HTML =
33
+ new DOMParser ( ) . parseFromString ( description , 'text/html' ) . body
34
+ . textContent || '' ;
36
35
}
37
36
38
37
return (
You can’t perform that action at this time.
0 commit comments