fix(playground): client-side session loading#55
Open
devallibus wants to merge 1 commit intodevelopmentfrom
Open
fix(playground): client-side session loading#55devallibus wants to merge 1 commit intodevelopmentfrom
devallibus wants to merge 1 commit intodevelopmentfrom
Conversation
Replace createServerFn/useServerFn with direct API calls. The playground doesn't need SSR — the editor and canvas are purely client-side. This eliminates hydration timing issues where useSearch reactive values aren't available when onMount fires. Changes: - playground.tsx: fetch session via /api/playground/create and /api/playground/:id/state instead of server functions - $.ts: remove auth requirement from POST /api/playground/create (creating an empty session is harmless — the UUID is the capability token) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
createServerFn/useServerFnwith direct API calls for session loadinguseSearchreactive values aren't available whenonMountfiresPOST /api/playground/create(creating an empty session is harmless — the UUID is the capability token)What was wrong
createResourcedoesn't integrate with TanStack Router SSR streaming → blank pageuseServerFn+onMountworked butuseSearchreactive value isn't hydrated at mount time → session ID alwaysundefined→ MCP-created sessions ignored, new session created insteadundefinedfor the session IDHow it works now
onMountreads?session=fromwindow.location.searchdirectly/api/playground/:id/stateto load existing session, or/api/playground/createfor new onesTest plan
/playground→ new session created, editor + canvas rendercreate_playground→ get session URL → open in browser → same session loads (not a new one)update_shaderwith browser open → canvas updates live via SSEget_errorswith broken GLSL → returns compilation errors🤖 Generated with Claude Code