Skip to content

fix(cli): fix preview opening wrong project in dev mode#221

Merged
miguel-heygen merged 1 commit intomainfrom
fix/preview-hash-route
Apr 7, 2026
Merged

fix(cli): fix preview opening wrong project in dev mode#221
miguel-heygen merged 1 commit intomainfrom
fix/preview-hash-route

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen commented Apr 7, 2026

Summary

One-character fix: removes leading / from the preview URL hash.

Dev mode opened #/project/<name> but the studio expects #project/<name>. The route regex in App.tsx (/^#project\/([^/]+)/) never matched the slash-prefixed hash, so it fell through to auto-selecting the first project from /api/projects — ignoring the project path you passed on the CLI.

Root cause

// preview.ts dev mode (line 176) — WRONG
`${frontendUrl}#/project/${pName}`

// App.tsx route parser (line 34) — expects this format
window.location.hash.match(/^#project\/([^/]+)/)

Local-studio mode and embedded mode already used the correct #project/ format.

Test plan

  • Typecheck passes
  • npx tsx cli preview /path/to/project opens the correct project in the studio

@miguel-heygen miguel-heygen marked this pull request as ready for review April 7, 2026 01:12
@miguel-heygen miguel-heygen force-pushed the fix/producer-postcss-esm branch from 7a618b8 to eb54b7b Compare April 7, 2026 01:18
@miguel-heygen miguel-heygen force-pushed the fix/preview-hash-route branch from 755cf74 to 0722171 Compare April 7, 2026 01:18
@miguel-heygen miguel-heygen force-pushed the fix/producer-postcss-esm branch from eb54b7b to eb1f836 Compare April 7, 2026 01:25
@miguel-heygen miguel-heygen force-pushed the fix/preview-hash-route branch from 0722171 to c34a95f Compare April 7, 2026 01:25
@miguel-heygen miguel-heygen force-pushed the fix/producer-postcss-esm branch from eb1f836 to f1e8590 Compare April 7, 2026 01:40
@miguel-heygen miguel-heygen force-pushed the fix/preview-hash-route branch from c34a95f to 7fccfc8 Compare April 7, 2026 01:40
Copy link
Copy Markdown
Collaborator Author

miguel-heygen commented Apr 7, 2026

Merge activity

  • Apr 7, 2:53 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 7, 3:39 PM UTC: Graphite rebased this pull request as part of a merge.
  • Apr 7, 3:40 PM UTC: @miguel-heygen merged this pull request with Graphite.

@miguel-heygen miguel-heygen changed the base branch from fix/producer-postcss-esm to graphite-base/221 April 7, 2026 15:18
@miguel-heygen miguel-heygen changed the base branch from graphite-base/221 to main April 7, 2026 15:37
The dev mode preview URL used `#/project/<name>` (with leading
slash) but the studio's App.tsx route parser expects `#project/`
(no leading slash). The hash never matched, so the studio fell
through to auto-selecting the first project from /api/projects
instead of the one specified on the command line.

Removes the leading slash to match the studio's expected format,
which local-studio and embedded modes already use correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@miguel-heygen miguel-heygen force-pushed the fix/preview-hash-route branch from 7fccfc8 to 6c4549c Compare April 7, 2026 15:38
@miguel-heygen miguel-heygen merged commit 25f34f7 into main Apr 7, 2026
14 checks passed
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.

2 participants