Skip to content

fix: stop studio route refresh loop#281

Merged
aloewright merged 1 commit into
mainfrom
codex/fix-studio-route-refresh
Jul 8, 2026
Merged

fix: stop studio route refresh loop#281
aloewright merged 1 commit into
mainfrom
codex/fix-studio-route-refresh

Conversation

@aloewright

@aloewright aloewright commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Route the SPA /studio fallback to the existing lazy Studio page instead of a window.location.replace('/studio') self-redirect.
  • Keep the header Studio nav as a hard /studio link so the production content-hub worker route can still intercept.
  • Add a DOM regression test that fails if /studio tries to replace the current location again.

Validation

  • NODE_OPTIONS=--localstorage-file=/tmp/spooool-vitest-localstorage.json npx vitest run src/frontend/App.shell.dom.test.tsx
  • npm run type-check
  • npm run build
  • npm run lint -- src/frontend/App.tsx src/frontend/App.shell.dom.test.tsx (completed with existing repo warnings, 0 errors)
  • Browser validation at http://127.0.0.1:5174/studio: settles on /login when unauthenticated; no blank route loop; no page exceptions.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d2be6643-b368-4735-8405-6dfd1ef947ee

📥 Commits

Reviewing files that changed from the base of the PR and between c44b653 and 3b2d4ad.

📒 Files selected for processing (2)
  • src/frontend/App.shell.dom.test.tsx
  • src/frontend/App.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/frontend/App.shell.dom.test.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: lint · type-check · test · build
  • GitHub Check: Workers Builds: spooool
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js,jsx,html,css,scss}

📄 CodeRabbit inference engine (AGENTS.md)

Strand stack utilities: require the base stack class for flex layout; size classes like stack-sm / stack-xl only control gap

Files:

  • src/frontend/App.tsx
🔍 Remote MCP Grep

Relevant review context found:

  • Public React apps commonly use Link to="/studio" for in-app Studio navigation, including nav bars and CTA buttons. Examples: supermosh/supermosh.github.io, olaxbt/ai-market-maker, Shubhamsaboo/awesome-llm-apps, and codevideo/studio.codevideo.io.
  • Route/page code-splitting with React.lazy(() => import(...)) is common in React apps, including route registries and app routers. Examples: supabase/supabase, coreui/coreui-free-react-admin-template, gitpod-io/gitpod, harness/harness, and getumbrel/umbrel.
  • router.replace('/login') / <Navigate to="/login" replace /> is commonly used for auth redirects, while window.location.replace(...) is used for hard redirects or external/legacy navigation. Examples: labring/FastGPT, simstudioai/sim, zulip/zulip, casdoor/casdoor, Automattic/wp-calypso, alibaba/nacos, and Stirling-Tools/Stirling-PDF.
🔇 Additional comments (4)
src/frontend/App.tsx (4)

66-66: LGTM!


248-251: 🎯 Functional Correctness

PR summary claims React Router navigation, but code keeps a hard <a href> link.

The PR objectives state the header's Studio nav was updated "to use React Router navigation so it no longer triggers a full page reload," but the actual control here is still a plain <a href="/studio">, which performs a full browser navigation, not client-side routing. The inline comment clarifies this is intentional (production content-hub worker needs to intercept the request), but that contradicts the stated PR goal for this specific control — clicking "Studio" in the header will still hard-reload the page in every environment, including local/dev.

Worth confirming this divergence between the PR description and the actual behavior is intentional before merge, since a reviewer relying on the summary could assume the header no longer triggers a reload.


782-784: LGTM!


844-844: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added a client-side /studio experience by lazy-loading and rendering the in-app Studio page.
    • Updated “Studio” navigation to open within the app (no full-page reload) and show the sign-in page.
  • Bug Fixes

    • Removed the prior browser redirect behavior for the /studio route.
  • Tests

    • Added a route test to ensure /studio renders the expected “Sign in” heading without invoking browser navigation APIs.

Walkthrough

The /studio route now renders the Studio page inside the app shell without a forced redirect. The header control and route test were updated to match the in-app navigation flow.

Changes

Studio Route Navigation

Layer / File(s) Summary
Studio route implementation and navigation link
src/frontend/App.tsx
Adds the lazy-loaded Studio import, updates the header Studio control markup and comments, removes StudioHubRedirect, and changes the /studio route to render <Studio /> directly.
Route behavior test
src/frontend/App.shell.dom.test.tsx
Adds a test that mounts /studio, asserts window.location.replace is not called, and verifies the rendered heading text is Sign in.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant HeaderControl
  participant ReactRouter
  participant StudioPage

  User->>HeaderControl: Click Studio
  HeaderControl->>ReactRouter: Navigate to /studio
  ReactRouter->>StudioPage: Render lazy-loaded Studio component
  StudioPage-->>User: Show Sign in page
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fix: stopping the /studio refresh loop.
Description check ✅ Passed The description matches the code changes and explains the routing fix, navigation update, and regression test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-studio-route-refresh

Warning

Review ran into problems

🔥 Problems

These MCP integrations need to be re-authenticated in the Integrations settings: Sentry


Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates the Studio route directly into the client-side app shell, replacing the previous full-page redirect behavior with client-side routing. Feedback points out an invalid HTML nesting issue where a <button> is placed inside a <Link> component, which should be styled directly instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/frontend/App.tsx Outdated
Comment on lines +250 to +252
<Link to="/studio">
<button type="button" className="btn btn--ghost btn--sm">Studio</button>
</a>
</Link>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Nesting a <button> inside a <Link> (which renders an <a> anchor tag) is invalid HTML according to the HTML5 specification (interactive content cannot be nested) and can cause accessibility issues for screen readers. Instead, you can style the <Link> directly using the button classes.

Suggested change
<Link to="/studio">
<button type="button" className="btn btn--ghost btn--sm">Studio</button>
</a>
</Link>
<Link to="/studio" className="btn btn--ghost btn--sm">
Studio
</Link>

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
spooool 3b2d4ad Jul 08 2026, 07:22 PM

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d3b87d7fb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/frontend/App.tsx Outdated
<a href="/studio">
{/* Studio is part of the app shell; keep navigation client-side so the
route settles instead of repeatedly reloading the same URL. */}
<Link to="/studio">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep Studio navigation as a full-page handoff

When a signed-in user clicks this Studio nav item from an already-loaded spooool page, React Router intercepts the click and no request is made to Cloudflare, so the spooool.com/studio* route to the separate editor worker cannot run. The content-hub spec still documents /studio as owned by that worker and explicitly requires a hard nav link/full-page handoff (docs/superpowers/specs/studio-content-hub.md:20-30,38-39), so this change leaves users in the legacy in-shell Studio instead of the hub whenever they navigate from the header.

Useful? React with 👍 / 👎.

@aloewright aloewright force-pushed the codex/fix-studio-route-refresh branch from 9d3b87d to c44b653 Compare July 8, 2026 19:18
@aloewright aloewright force-pushed the codex/fix-studio-route-refresh branch from c44b653 to 3b2d4ad Compare July 8, 2026 19:21
@aloewright aloewright merged commit 0ddbf08 into main Jul 8, 2026
3 checks passed
@aloewright aloewright deleted the codex/fix-studio-route-refresh branch July 8, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant