Skip to content

Commit d1c4e82

Browse files
chanceaclarkclaude
andcommitted
fix(core): remove DOMPurify from ProductReviewSchema to fix SSR crash
DOMPurify requires a browser DOM and throws during SSR. Since the input is already `JSON.stringify()` output for a JSON-LD script tag, HTML sanitization is unnecessary. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5143081 commit d1c4e82

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

core/app/[locale]/(default)/product/[slug]/_components/product-review-schema/product-review-schema.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use client';
22

3-
// eslint-disable-next-line import/no-named-as-default
4-
import DOMPurify from 'dompurify';
53
import { useFormatter } from 'next-intl';
64
import { Product as ProductSchemaType, WithContext } from 'schema-dts';
75

@@ -43,7 +41,7 @@ export const ProductReviewSchema = ({ reviews, productId }: Props) => {
4341

4442
return (
4543
<script
46-
dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(JSON.stringify(productReviewSchema)) }}
44+
dangerouslySetInnerHTML={{ __html: JSON.stringify(productReviewSchema) }}
4745
type="application/ld+json"
4846
/>
4947
);

0 commit comments

Comments
 (0)