Gen2 React SDK: Content overrides break during preview
- Dominant language
- TypeScript
- Stars
- 8.8k
- Forks
- 1.2k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 17
Description
**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 ``
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Read packages/sdks/src/components/content/components/enable-editor.lite.tsx around lines 307-321, then reproduce the issue by removing a block from content.data.blocks before passing it to Content and entering preview. Done means manipulated API content no longer produces unexpected behavior from the preview refetch and merge path, with the intended opt-out or preservation behavior verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100