SSR demo chunks for guest first page view#67
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
558cc6a to
2c3649d
Compare
2c3649d to
d936789
Compare
Load the first demo source's parsed chunks during the server render so guest users see content immediately — no loading spinner on first visit. Uses unstable_cache with revalidate: false so the fetched chunks are shared across all users. The chunk prefetch is best-effort; if it fails, the client falls back to loading chunks on demand.
d936789 to
40b3af0
Compare
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
Closes #66
Guest users previously saw an empty chunks panel on first visit while demo data was loaded client-side. This loads the first demo source's parsed chunks during SSR so they appear immediately — no loading spinner, no delay.
Caching
Uses
unstable_cachefrom Next.js withrevalidate: falseso the demo chunk data is cached across all users. The Knowhere API demo chunks endpoint is called once, then the parsed result is served from memory for every subsequent request until the server restarts.The prefetch is best-effort — if the API is unavailable during SSR, the client gracefully falls back to loading chunks on demand.
Changes
src/domains/workspace/initial-state.ts— In the guest path, fetches the first demo source's chunks viaknowhereDemoApi.fetchChunkPage(), converts them toParsedChunkView, and caches the result withunstable_cache. Passes asinitialPrefetchedChunksBySourceIdin the shell initial state.src/components/workspace-shell.tsx— AcceptsinitialPrefetchedChunksBySourceIdprop and passes it directly touseWorkspaceCitationFocus, which already supports seeding viainitialPrefetchedChunksBySourceId.Test plan