Skip to content

FE-1500: add the example embed route - #9427

Draft
kube wants to merge 2 commits into
codex/fe-1500-viewer-simulationfrom
claude/fe-1500-embed
Draft

FE-1500: add the example embed route#9427
kube wants to merge 2 commits into
codex/fe-1500-viewer-simulationfrom
claude/fe-1500-embed

Conversation

@kube

@kube kube commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

Adds the framed-only embed route /embed/examples/<slug>/versions/<revision>: it lazy-loads PetrinautPreview with Quick Simulation configured from the example's generated artifacts and catalog playback settings. Stacked on #9361.

🔗 Related links

🔍 What does this change?

  • New embed route with a framed-window guard: a direct (top-level) visit redirects to the canonical example page with the same state, so the preview is not a second website mode.
  • EmbeddedExamplePage lazy-imports PetrinautPreview from @hashintel/petrinaut/preview and builds its quickSimulation from loadExampleRuntime plus catalog playback config and parameter bounds; navigation always uses replace-history inside the iframe.
  • Adds the preview URL codec to navigation-search.ts (previewSearchToNavigationState, navigationStateToPreviewSearch, applyPreviewNavigationUpdate) over the shared scenario/subnet/selection search subset, and normalizes unsupported query fragments away on entry.
  • Adds the /embed/examples/* SPA rewrite to vercel.json.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ 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: embed-route.test.ts (framed-window guard, search normalization), the preview-codec case in navigation-search.test.ts, and fast-check properties in navigation-search.property.test.ts proving normalizePreviewSearch is idempotent (so the redirect in beforeLoad terminates) and preview states survive encode then decode.

❓ How to test this?

  1. Checkout the branch and run yarn workspace @hashintel/petrinaut build:lib, then yarn workspace @apps/petrinaut-website dev.
  2. Visit http://localhost:5173/embed/examples/gases-1-pn/versions/1 directly and confirm it redirects to the canonical example page.
  3. Load the same URL inside an iframe (any local HTML page) and confirm the preview renders with Quick Simulation, and that scenario, subnet, and selection changes rewrite the iframe URL without adding history entries.

@kube kube self-assigned this 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 8:17pm
petrinaut Ready Ready Preview Aug 29, 2026 8:17pm
petrinaut-docs Ready Ready Preview Aug 29, 2026 8:17pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 29, 2026 8:17pm

Request Review

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

Development

Successfully merging this pull request may close these issues.

1 participant