Skip to content

FE-1500: add controlled Petrinaut navigation - #9426

Draft
kube wants to merge 2 commits into
claude/fe-1500-presentationfrom
claude/fe-1500-navigation
Draft

FE-1500: add controlled Petrinaut navigation#9426
kube wants to merge 2 commits into
claude/fe-1500-presentationfrom
claude/fe-1500-navigation

Conversation

@kube

@kube kube commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

Makes Petrinaut's app location controllable by the host: a new navigation prop accepts a router-neutral controller through which mode, Simulate section and resource, scenario, subnet, canvas selection, and creation drawers can be read, driven, and recorded as browser history. Without the prop, behaviour is unchanged. Stacked on the presentation-profiles PR.

🔗 Related links

🔍 What does this change?

  • New react/navigation module: PetrinautNavigationState, a controller contract (state + onNavigate with updater functions), navigation intents with a push-vs-replace history policy, selection canonicalization, and helpers such as openPetrinautSimulationResource and revealPetrinautEditorItem.
  • Editor adoption: EditorProvider derives mode, Simulate view, drawer, and selection from navigation state; experiments, optimizations, simulation-scenario, and subnet selection navigate instead of setting local state; invalid locations normalize back with replace-history intents.
  • Selection gestures batch: React Flow callback bursts within one event coalesce through an optimistic-state ref, and drag-selection records one history entry per gesture.
  • Creation drawers become app locations: a central SimulationCreationDrawer host replaces the per-view drawer mounts, so opening and closing scenario, metric, experiment, and optimization drawers participates in Back/Forward.
  • Documents the behaviour in the user guide (drawing-a-net.md, experiments.md, visual-settings.md).

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • modifies an npm-publishable library and I have added a changeset file(s)

📜 Does this require a change to the docs?

The changes in this PR:

  • require changes to docs which are made as part of this PR

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • New: react/navigation/index.test.tsx (controlled and uncontrolled providers, intents, canonicalization, drawer conversions), react/simulation/provider.test.tsx (scenario selection canonicalization), simulation-creation-drawer.test.tsx, and navigation assertions in the experiments and optimizations provider tests.
  • Existing: editor context fixtures updated across the suite.

❓ How to test this?

  1. Checkout the branch and run yarn workspace @hashintel/petrinaut dev.
  2. Confirm the editor behaves as before (the demo passes no controller, so navigation is uncontrolled).
  3. Website-level Back/Forward behaviour is exercised by the examples PR stacked above.

@kube kube self-assigned this Aug 29, 2026
@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/apps > hash.design Affects the `hash.design` design site (app) labels Aug 29, 2026
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview Aug 29, 2026 12:32am
petrinaut Ready Ready Preview Aug 29, 2026 12:32am
petrinaut-docs Ready Ready Preview Aug 29, 2026 12:32am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 29, 2026 12:32am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash.design Affects the `hash.design` design site (app) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant