You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Modify the content somehow, for example delete a block content.data.blocks = content.data.blocks.slice(1)
Pass this content to <Content content={content}>
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.
The text was updated successfully, but these errors were encountered:
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 theContent
component, for example removing items fromblocks
or using something liketransformComponents
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:
content.data.blocks = content.data.blocks.slice(1)
<Content content={content}>
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.
The text was updated successfully, but these errors were encountered: