fix(sandbox): refetch the entity when the dev server comes up - #5317
Merged
Conversation
previewUrl (used to gate the CMS/Content panels) is derived from the virtual MCP entity's sandboxMap, which is cached for 60s and only refetched on explicit invalidation. SANDBOX_START can resolve, and the SSE lifecycle can reach "running", before the pod has finished writing previewUrl into sandboxMap — so on a cold-start open the entity query never refetches and the panel is stuck until a hard page refresh. Invalidate the virtual MCP collection-item query at the same point we already invalidate the decofile/live-meta queries on the running transition, so previewUrl picks up the freshly-written sandboxMap entry without a manual reload.
pedrofrxncx
enabled auto-merge (squash)
July 27, 2026 23:27
decocms Bot
pushed a commit
that referenced
this pull request
Jul 27, 2026
PR: #5317 fix(sandbox): refetch the entity when the dev server comes up Bump type: patch - decocms (apps/api/package.json): 4.138.7 -> 4.138.8 Deploy-Scope: web
pedrofrxncx
added a commit
that referenced
this pull request
Jul 28, 2026
previewUrl (used to gate the CMS/Content panels) is derived from the virtual MCP entity's sandboxMap, which is cached for 60s and only refetched on explicit invalidation. SANDBOX_START can resolve, and the SSE lifecycle can reach "running", before the pod has finished writing previewUrl into sandboxMap — so on a cold-start open the entity query never refetches and the panel is stuck until a hard page refresh. Invalidate the virtual MCP collection-item query at the same point we already invalidate the decofile/live-meta queries on the running transition, so previewUrl picks up the freshly-written sandboxMap entry without a manual reload.
pedrofrxncx
pushed a commit
that referenced
this pull request
Jul 28, 2026
PR: #5317 fix(sandbox): refetch the entity when the dev server comes up Bump type: patch - decocms (apps/api/package.json): 4.138.7 -> 4.138.8 Deploy-Scope: web
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.
Fixes #3482.
Payoff: the Sections-Editor/Content panel gets permanently stuck on a spinner on a cold-start open of a virtual MCP, requiring a hard page refresh — a first-run experience bug users hit constantly.
Root cause:
previewUrl(which gates the CMS/Content panels — seesandbox-lifecycle-context.tsx'svmEntry?.previewUrl) is derived from the virtual MCP entity'ssandboxMap, fetched via auseSuspenseQuerywith a 60sstaleTimeand no live-push subscription.SANDBOX_STARTcan resolve, and the SSE lifecycle can reach"running", before the pod has finished writing itspreviewUrlinto that entity'ssandboxMap— so on first open, nothing ever re-fetches the entity andpreviewUrlstaysnulluntil the user does a hard refresh (which re-fetches everything from scratch).Fix:
sandbox-events-context.tsxalready invalidates the decofile/live-meta queries at thelifecycle.phase === "running"transition (the exact moment the dev server confirms up). This adds one more invalidation at that same point — the virtual-MCP collection-item query (via the existinginvalidateVirtualMcpQuerieshelper) — so the entity refetches andpreviewUrlpicks up the freshly-writtensandboxMapentry without a manual reload.Verify:
bun run fmtandcd apps/web && bunx tsc --noEmitboth pass. This is a live-SSE reactivity path (EventSource + entity cache) that isn't cheaply unit-testable without mocks the repo's testing rules disallow for the unit tier — full CI/e2e validates the rest; a reviewer can confirm by opening a virtual MCP from a cold start and immediately switching to the Content/CMS tab (repro steps in #3482) and observing it now self-heals instead of requiring a refresh.Diff: +8/-1, one file, one concern.
Summary by cubic
Fixes a cold-start race that left the Sections-Editor/Content panel stuck on a spinner. When the dev server reports “running,” we now refetch the virtual MCP entity so
previewUrlupdates without a hard refresh.lifecycle.phase === "running", callinvalidateVirtualMcpQueriesto re-fetch the virtual MCP collection-item query and pick up thesandboxMappreviewUrl.Written for commit 23955cd. Summary will update on new commits.