spike: mirror Dipankar's React SDK approach for live preview eval - #627
Closed
maoberlehner wants to merge 2 commits into
Closed
spike: mirror Dipankar's React SDK approach for live preview eval#627maoberlehner wants to merge 2 commits into
maoberlehner wants to merge 2 commits into
Conversation
Inlines Dipankar's storyblok-react-sdk (createStoryblokRenderer + factory resolver + promise cache + useStoryblokPreview) into the next-latest playground under a dedicated experiment/ route, paired with a stub bridge and stub client response so the renderer/resolver/cache logic can be exercised without external services. Bloks cover the cases we want to validate against the spike/react SDK: server/client nesting, deep alternation, context through a server subtree, async server fetch, and a server-only env var.
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.
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.
Summary
Spike that inlines Dipankar's storyblok-react-sdk (
createStoryblokRenderer+ factory resolver + promise cache +useStoryblokPreview) into thenext-latestplayground under a dedicatedexperiment/route, paired with a stub bridge and stub CAPI response so the renderer/resolver/cache logic can be exercised without external services.Goal: side-by-side comparison with the
spike/reactSDK approach to evaluate which direction we want to take for React + RSC live preview.What's in
experiment/_sdk/— near-verbatim mirror of Dipankar's SDK (create-resolver,create-storyblok-renderer,promise-cache,use-storyblok-preview). The only adaptation: the preview hook subscribes to a stub bridge instead of@storyblok/live-preview'sonStoryblokEditorEvent— same contract, deterministic signal._bloks/— server + client bloks covering the cases we want to validate: server/client nesting, deep alternation, context through a server subtree, async server fetch (async-server-fetch), and a server-only env var (server-only-secret)._stub/— hardcoded client response + in-process bridge with manual edit controls, so preview behavior can be triggered without the Storyblok app.Test plan
pnpm nx dev @storyblok/playground-react-next-latestand visit/experiment— page renders the nested storyuse()+ Suspense)server-only-secretblok: confirmprocess.env.SERVER_ONLY_SECRETisundefinedduring client-side preview re-render (the contrast point with the server-action approach inspike/react)async-server-fetchblok: confirm async server component unwraps viause()cache without re-fetching on unrelated editspnpm nx lint @storyblok/playground-react-next-latestNot for merge
Draft / spike — kept on the
spike/branch namespace. Decision artifact, not a feature.