Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[StoryblokRichText] Rendering immutable richText object #1353

Open
1 task done
7alip opened this issue Feb 27, 2025 · 1 comment
Open
1 task done

[StoryblokRichText] Rendering immutable richText object #1353

7alip opened this issue Feb 27, 2025 · 1 comment
Labels
has-workaround [Issue] Temporary solutions available. investigation [Issue] The Storyblok team is investigating

Comments

@7alip
Copy link

7alip commented Feb 27, 2025

Describe the issue you're facing

We encountered an issue where the StoryblokRichText and richTextResolver's render function do not support immutable Storyblok data.

Our setup uses Apollo GraphQL to fetch Storyblok content. In production, certain pages were throwing errors in specific languages. After investigation, we found that the issue likely stemmed from Apollo’s immutable response structure. We resolved this by wrapping all Storyblok content with cloneDeep.

To further diagnose the issue, we created a minimal reproduction and found that the error occurs when the rich text contains attributes.

Would it be possible for Storyblok to handle this internally to ensure compatibility with immutable data sources?

Reproduction

https://stackblitz.com/edit/bb-storblok

Steps to reproduce

No response

System Info

@storyblok/react@^4.4.0

Used Package Manager

yarn

Error logs (Optional)

storyblok-js.mjs:991 Uncaught TypeError: Cannot add property key, object is not extensible
    at eval (storyblok-js.mjs:991:24)
    at x (storyblok-js.mjs:1114:12)
    at Array.map (<anonymous>)
    at C (storyblok-js.mjs:1121:45)
    at eval (storyblok-rich-text.mjs:17:13)
    at renderWithHooks (react-dom.development.js:10707:18)
    at updateForwardRef (react-dom.development.js:14692:20)
    at beginWork$1 (react-dom.development.js:17392:16)
    at HTMLUnknownElement.callCallback (react-dom.development.js:19462:14)
    at Object.invokeGuardedCallbackImpl (react-dom.development.js:19511:16)
    at invokeGuardedCallback (react-dom.development.js:19586:29)
    at beginWork (react-dom.development.js:25724:7)
    at performUnitOfWork (react-dom.development.js:24553:12)
    at workLoopSync (react-dom.development.js:24269:5)
    at renderRootSync (react-dom.development.js:24224:7)
    at performSyncWorkOnRoot (react-dom.development.js:23701:20)
    at flushSyncWorkAcrossRoots_impl (react-dom.development.js:9975:13)
    at flushSyncWorkOnAllRoots (react-dom.development.js:9933:3)
    at processRootScheduleInMicrotask (react-dom.development.js:10077:3)
    at eval (react-dom.development.js:10248:7)

Validations

@7alip 7alip added pending-author [Issue] Awaiting further information or action from the issue author pending-triage [Issue] Ticket is pending to be prioritised labels Feb 27, 2025
@edodusi
Copy link
Contributor

edodusi commented Mar 12, 2025

Hi @7alip, honestly I don't know if we should extend the base library to address this or just covering this with documentation, to help users in your situation. I see this as a limited case that can happen in specific conditions.

I will add this to an internal discussion and let you know if we decide to take a step in one direction.

Thank you for having reported this

@edodusi edodusi added investigation [Issue] The Storyblok team is investigating has-workaround [Issue] Temporary solutions available. and removed pending-author [Issue] Awaiting further information or action from the issue author pending-triage [Issue] Ticket is pending to be prioritised labels Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-workaround [Issue] Temporary solutions available. investigation [Issue] The Storyblok team is investigating
Projects
None yet
Development

No branches or pull requests

2 participants