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

Gen2 React SDK: Content overrides break during preview #3689

Open
nathanforce opened this issue Oct 26, 2024 · 0 comments
Open

Gen2 React SDK: Content overrides break during preview #3689

nathanforce opened this issue Oct 26, 2024 · 0 comments

Comments

@nathanforce
Copy link

Describe the bug

The Gen2 React SDK accepts content as a prop but during preview (and in visual editor) implicitly expects that content to be an unmodified response from the Content API. If a user manipulates the content api response before passing to the Content component, for example removing items from blocks or using something like transformComponents from @builder.io/utils, the sdk will refetch fresh content from the API and merge that with the manipulated content, resulting in unexpected behavior.

https://github.com/BuilderIO/builder/blob/main/packages/sdks/src/components/content/components/enable-editor.lite.tsx#L307-L321

To Reproduce
Steps to reproduce the behavior:

  1. Fetch content from Content API
  2. Modify the content somehow, for example delete a block content.data.blocks = content.data.blocks.slice(1)
  3. Pass this content to <Content content={content}>
  4. Preview the page

Expected behavior
I expect to be able to manipulate the content fetched from the API as needed for my use case or opt out of the refetching behavior linked above.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant