feat(web): all 5 examples grouped under examples/ + autoload first one#109
Conversation
- example-flows.ts now imports every YAML in /examples/ (5 flows up from 3): simple-crud, auth-flow, order-flow, self-loops, type-variants. The path field is overridden to a single \`examples\` root for all entries so the sidebar tree groups them under one folder rather than scattering across whatever each YAML's own meta.path happens to say (e-commerce/orders, demos, ...). - AppFragment first-visit autoload: when the URL has no hash, history.replaceState the encoded YAML of EXAMPLE_FLOWS[0] so the canvas isn't empty on landing. replaceState (not assign) keeps the empty URL out of back/forward history. Pages-only because AppFragment is the Pages bundle; the local app (App.tsx) has its own server-driven flow list and is untouched. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe PR adds two bundled example flows and a shared EXAMPLES_ROOT, then adds a mount-time useEffect in AppFragment that, when the URL fragment is empty, encodes EXAMPLE_FLOWS[0], replaces the browser fragment with it, and initializes the component hash so the canvas loads that example. ChangesFirst-Visit Example Autoload
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/web/src/AppFragment.tsx`:
- Around line 60-65: The autoload logic treats a lone "#" as a real hash and
also drops query parameters when replacing the URL; update the early-return
check to treat "#" as empty (e.g., if (window.location.hash &&
window.location.hash !== '#') return) and when calling history.replaceState
include window.location.search so you preserve query params (use
`${window.location.pathname}${window.location.search}#${fragment}`), keeping
references to EXAMPLE_FLOWS, encodeFragment, setHash, and history.replaceState.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a2a9971c-e1c3-4004-b870-df06341aa670
📒 Files selected for processing (2)
packages/web/src/AppFragment.tsxpackages/web/src/lib/example-flows.ts
Two edge cases CodeRabbit flagged on #109: - A trailing `#` with nothing after returns `'#'` from `window.location.hash` (truthy), so the early-return missed it and the autoload bailed out on URLs like `/openhop/#`. Tighten the check to treat `'#'` as empty. - `history.replaceState` was building the new URL from `pathname + '#' + fragment`, dropping any `?query=…`. Splice `window.location.search` back in so query params survive the rewrite. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…test - @openhop/server: 0.1.0-beta.2 → 0.1.0 - @openhop/web: 0.1.0-beta.4 → 0.1.0 - openhop CLI: 0.1.0-beta.6 → 0.1.0 + bump pinned @openhop/server, @openhop/web deps + hardcoded --version publish.yml: drop `--tag beta` from all three publish steps. With no --tag, `npm publish` sets the `latest` dist-tag — so npmjs.com pages and `npm install <pkg>` (no @beta suffix) automatically reflect the new version on every successful publish. No more manual `npm dist-tag add latest` step. Bundles 13 PRs since v0.1.0-beta.6: Web (heavy): - #106 sprite URLs use Vite BASE_URL (Pages 404 fix) - #107 example flow cards on empty state - #108 sidebar + carrot-click highlight for string-data steps - #109 all 5 examples grouped under examples/ + first-visit autoload - #112 per-step auto-zoom + playback speed button - #113 collapse FLOWS / INSPECT by default on mobile - #114 lazy editor + vendor-split chunks + meta description - #115 filter codemirror from <modulepreload> - #117 memo FlowNode + GPU-layer sprites for smoother pan/zoom CLI: - #116 OpenSkills fallback hint when no Tier-1 client gets the skill - #118 suppress the hint when Tier-1 already has the skill Server: untouched code; bumped to keep the 0.1.0 set consistent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…test (#119) - @openhop/server: 0.1.0-beta.2 → 0.1.0 - @openhop/web: 0.1.0-beta.4 → 0.1.0 - openhop CLI: 0.1.0-beta.6 → 0.1.0 + bump pinned @openhop/server, @openhop/web deps + hardcoded --version publish.yml: drop `--tag beta` from all three publish steps. With no --tag, `npm publish` sets the `latest` dist-tag — so npmjs.com pages and `npm install <pkg>` (no @beta suffix) automatically reflect the new version on every successful publish. No more manual `npm dist-tag add latest` step. Bundles 13 PRs since v0.1.0-beta.6: Web (heavy): - #106 sprite URLs use Vite BASE_URL (Pages 404 fix) - #107 example flow cards on empty state - #108 sidebar + carrot-click highlight for string-data steps - #109 all 5 examples grouped under examples/ + first-visit autoload - #112 per-step auto-zoom + playback speed button - #113 collapse FLOWS / INSPECT by default on mobile - #114 lazy editor + vendor-split chunks + meta description - #115 filter codemirror from <modulepreload> - #117 memo FlowNode + GPU-layer sprites for smoother pan/zoom CLI: - #116 OpenSkills fallback hint when no Tier-1 client gets the skill - #118 suppress the hint when Tier-1 already has the skill Server: untouched code; bumped to keep the 0.1.0 set consistent. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two related Pages-only changes.
All 5 examples
`example-flows.ts` previously listed only 3 of the 5 YAMLs in `/examples/`. Now imports every one (simple-crud, auth-flow, order-flow, self-loops, type-variants) via the same Vite `?raw` pattern so the source-of-truth stays in the repo's `examples/*.yaml`.
The `path` field is overridden to a single `examples` root for every entry so the sidebar tree groups all of them under one folder, even though the YAMLs' own `meta.path` values diverge (some use `e-commerce/orders`, `demos`, etc).
Autoload first example on no hash
Visiting Pages without a flow fragment landed on an empty canvas. Now `AppFragment` `history.replaceState`s the encoded YAML of `EXAMPLE_FLOWS[0]` (Simple CRUD) so the canvas is populated on first visit. `replaceState` (not `assign`) keeps the empty URL out of back/forward history.
Pages-only because `AppFragment` is the Pages bundle; `App.tsx` (local app) has its own server-driven flow list and is untouched.
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit