mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Shell: one-shot #spec-<payload> link consumed at startup
This commit is contained in:
@@ -51,14 +51,16 @@ 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.
|
||||
action_ — `#example-<id>` (add that gallery example) and `#spec-<payload>` (add
|
||||
the spec carried in the payload; `@core/spec-link` owns the base64url encoding,
|
||||
shared with the learn pages that build such links) — stays out of the
|
||||
`ViewState` union: each 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. Action links
|
||||
never serialize back and never participate in Back/Forward; `parseHash`
|
||||
degrades them like any unknown hash. Any future action link follows the same
|
||||
shape rather than growing the view-state union.
|
||||
|
||||
### 1.2 The adapter: `infrastructure/url-hash.ts`
|
||||
|
||||
|
||||
@@ -102,7 +102,10 @@ 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.
|
||||
**One-shot action links.** Two hash forms are not view states but requests, consumed on load: the app adds a snippet, 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 one with an empty library skips the onboarding canvas and lays the workspace out at the same default split leaving the canvas would. Each visit deliberately creates a new copy.
|
||||
|
||||
- `#example-<id>` adds the matching gallery example (see _Snippet Library → First-Run & Empty Workspace_), named as in the gallery (same as pressing its **Add**). An unknown id is ignored and the hash degrades to the default view. 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.
|
||||
- `#spec-<payload>` carries a spec's own text (base64url-encoded), so any sender — a lesson stage's "Open in Astrolabe", a shared link — can hand a self-contained spec into the app. The snippet's name derives from the spec (its `title`, else a "Mark chart of y by x" phrase, else "Shared spec"), like a pasted spec. A malformed payload is ignored and the hash degrades to the default view.
|
||||
|
||||
## F. Toast Notifications
|
||||
|
||||
|
||||
Reference in New Issue
Block a user