chore(react): RSC live-preview nesting spike playground - #628
Closed
maoberlehner wants to merge 2 commits into
Closed
chore(react): RSC live-preview nesting spike playground#628maoberlehner wants to merge 2 commits into
maoberlehner wants to merge 2 commits into
Conversation
Validates the v2 React SDK bet (plans/architecture.md §3.4/§5): one "use server" render(story) action, re-invoked on each edit, drives live-preview re-renders through arbitrarily nested server/client bloks resolved via a component registry. Registry-driven model with a crisp stub boundary: only the client response (initial story JSON) and the live-preview bridge are stubbed under _stub/; the registry, recursive resolver, blok components, StoryblokView and the live-preview island under _sdk/ and _bloks/ are real-SDK-shaped.
Adds `_stub/server-db.ts` with a module-level guard (throws if imported on the client) and an async `getAuthorById()` with artificial latency. Makes `server-quote` async and awaits the lookup so the preview path is exercised against a server-only async dependency.
@storyblok/angular
@storyblok/astro
@storyblok/api-client
storyblok
@storyblok/eslint-config
@storyblok/js
storyblok-js-client
@storyblok/live-preview
@storyblok/management-api-client
@storyblok/migrations
@storyblok/nuxt
@storyblok/react
@storyblok/region-helper
@storyblok/richtext
@storyblok/svelte
@storyblok/vue
commit: |
Contributor
Author
|
Spike concluded; superseded by #665 (new React SDK). Closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A throwaway spike in
packages/react/playground/next-latest/src/app/experiment/validating the v2 React SDK's central bet (plans/architecture.md§3.4/§5): a single"use server"render(story)action, re-invoked on each edit, can drive live-preview re-renders through arbitrarily nested server/client bloks resolved through a component registry.Approach
Registry-driven, with a crisp real vs. stubbed boundary — to make it production-real you swap exactly two things:
_stub/(the only stubbed pieces): the client response (initial story JSON, normally a CAPI fetch) and the live-preview bridge (normally@storyblok/live-preview'sonStoryblokEditorEvent, here a JSON-textarea + Submit that fakes editorinputevents)._sdk/+_bloks/(real-SDK-shaped):types, the recursive resolver (storyblok-component),StoryblokView, the live-preview island, and the registered server/client bloks.The resolver pre-renders nested
bodybloks on the server and passes them aschildren, which is what lets server and client bloks nest to any depth (the one legal server-in-client direction).Coverage
Seed story exercises client-in-server, server-in-client (via children), deep S>C>S>C alternation, client context through a server subtree, an async server component, and server-only (
process.env) access.Verified
?lp=0and?lp=1; island + JSON editor only in?lp=1.Notes
findings/,plans/,packages/schema/are intentionally not part of this PR.