FE-1500: Add URL navigation to every Petrinaut website demo - #9491
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryMedium Risk Overview Wires Exports Reviewed by Cursor Bugbot for commit 0f0ce0c. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
🟡 Changes recommended
The controlled Brunch navigation defaults to Edit mode, preventing the editor from using the live Actual-mode stream.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds shared URL navigation to Petrinaut’s editable, optimization, and Brunch demos.
Changes:
- Connects shared search state to Petrinaut navigation.
- Preserves Brunch stream parameters during navigation.
- Updates validation, tests, and architecture documentation.
File summaries
| File | Description |
|---|---|
libs/@local/petrinaut-arch-docs/content/website/router-integration.mdx |
Documents supported routes and Brunch behavior. |
apps/petrinaut-website/src/routes/optimization.tsx |
Adds search-driven optimization navigation. |
apps/petrinaut-website/src/routes/index.tsx |
Adds search-driven editable-demo navigation. |
apps/petrinaut-website/src/routes/brunch.tsx |
Preserves stream keys while navigating. |
apps/petrinaut-website/src/main/app/optimization-demo/optimization-demo-app.tsx |
Forwards navigation props. |
apps/petrinaut-website/src/main/app/local-storage-demo/local-storage-demo-app.tsx |
Supplies a navigation controller to Petrinaut. |
apps/petrinaut-website/src/main/app/brunch-demo/brunch-search.ts |
Combines stream and shared-search validation. |
apps/petrinaut-website/src/main/app/brunch-demo/brunch-search.test.ts |
Tests combined search validation. |
apps/petrinaut-website/src/main/app/brunch-demo/brunch-petrinaut.tsx |
Passes navigation into Petrinaut. |
apps/petrinaut-website/src/main/app/brunch-demo/brunch-demo-app.tsx |
Creates Brunch navigation state. |
apps/petrinaut-website/src/main/app/brunch-demo/brunch-actual-mode-route.tsx |
Threads navigation through the Brunch route. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2f23b50. Configure here.
A controlled navigation controller replaces PetrinautNavigationProvider's initial state, including the Actual-mode default it applies when a live stream is available, so the Brunch route opened in Edit mode and the execution frame read the local simulation instead of the stream. useSharedSearchNavigation takes an initialState option for the fields the URL does not carry, and the Brunch demo seeds mode: actual. The URL still wins for the fields it owns.
The hook mistook the echo of its own URL write for an external change and merged the lossy projection back over the in-memory location, so selecting a second node cleared the selection. The echo is now suppressed once, and a later Back or Forward onto the same location still merges. Switching nets in the editable demo carried the previous net's location: Petrinaut resets its own location per document by keying on the handle id, which only covers an uncontrolled location. The demo clears the URL on a net switch instead. Selection changes no longer push a browser history entry on the editable demo, where Back would otherwise take dozens of presses to leave the page. The stream-key carry-over moves out of the route into withBrunchStreamKeys and is applied to the router's own previous search. initialState accepts only the fields the URL does not own, rather than discarding the rest.
f477a22 to
c1ef9b3
Compare

Summary
Before this PR, only the example pages at
/examples/<slug>and/embed/examples/<slug>mirrored Petrinaut's location to the URL. The editable demo at/, the optimization demo, and the Brunch stream kept scenario, subnet, and selection in memory. A link to one of those pages opened the default location, and Back and Forward moved between pages only.Every page on demo.petrinaut.org that mounts Petrinaut now speaks the shared contract:
scenario,subnet,itemType,itemId.9491.mp4
Links
Changes
/and/optimizationvalidate the shared search and pass it to the demo app/brunchvalidates its stream keys together with the shared contractThe URL carries the editor's mode, its Simulate section and the open overlay, alongside the scenario, the subnet and the focused item
The mode and Simulate-section vocabularies are exported from
@hashintel/petrinaut/reactReview fixes
/brunchopens in Actual modewithBrunchStreamKeysTest coverage
brunch-search.test.ts:use-shared-search-navigation.test.tsx:local-storage-demo-app.test.tsx:local-storage-demo-app.test.tsx,brunch-demo-app.test.tsx:use-shared-search-navigation.test.tsx:use-shared-search-navigation.test.tsx,example-search.test.ts,navigation-search.test.ts:How to test
Location and history
Invalid and foreign params
/?itemType=place&itemId=bogus&scenario=none&junk=1Brunch stream keys
/brunch?sse=<endpoint>&scenario=<id>