Shell: one-shot #example-<id> deep link consumed at startup

This commit is contained in:
2026-07-04 16:40:56 +03:00
parent db258a4e54
commit 5ec7c3aa77
5 changed files with 79 additions and 0 deletions
@@ -50,6 +50,16 @@ serializes the builder's no-datasets state only: an un-targeted builder open
picks a dataset itself when any exist, so the derived view immediately
self-corrects to the `dataset-build` form.
**One-shot action links are not view states.** A hash form that _requests an
action_ (`#example-<id>`: add that gallery example and open it — spec §01E)
stays out of the `ViewState` union: it is parsed by its own function in
`url-hash.ts`, consumed once at startup (`orchestration/startup.ts`, after
persistence wiring so the created record write-throughs, before `startRouting`),
and then routing's settle step replaces the hash with the resulting view. It
never serializes back and never participates in Back/Forward; `parseHash`
degrades it like any unknown hash. Any future action link (e.g. a spec-payload
link) follows the same shape rather than growing the view-state union.
### 1.2 The adapter: `infrastructure/url-hash.ts`
This is the only file that reads or writes `window.location` / `history`. It
+2
View File
@@ -102,6 +102,8 @@ Behavior:
- On load, the app reads the hash and restores the corresponding state (selected snippet, Datasets list, a specific dataset, the new-dataset form, or the Chart Builder).
- An empty/absent hash opens the default snippets view with no modal.
**One-shot action link.** `#example-<id>` is not a view state but a request: on load, the app adds the matching gallery example (see _Snippet Library → First-Run & Empty Workspace_) as an ordinary snippet and opens it, then replaces the hash with the created snippet's view — so reloading does not re-add it, and the link never appears in Back/Forward history. Landing at it with an empty library skips the onboarding canvas and lays the workspace out at the same default split leaving the canvas would. An unknown id is ignored and the hash degrades to the default view. Each visit to such a link deliberately creates a new copy (same as pressing an example's **Add**). The landing uses these links (the hero's "Open in Astrolabe") to hand a visitor into the app carrying the chart they were just looking at.
## F. Toast Notifications
Transient toast messages appear in a corner of the screen to confirm actions or report problems, without interrupting the workflow.