Repository navigation
Commit bb66b43
examples: idiomatic pass — hackernews twins, notes, occlusion specs (#3717)
* examples: hackernews collapse as a binding slot, twins in the authoring layout
The thread's collapse was a `Toggle` client component wrapping a template
slot. It is now a binding slot on server markup: the recursive `Comment` is
a server component, and each comment with replies calls
`props.toggle({ $key: c.id })` and binds the toggle's `open` class name,
its `onClick`, its label (a text position) and the replies' `display`. The
fill is the SPA twin's `Toggle` without its markup: a signal in the body,
getters over it, a plain handler. No client components remain.
Both twins take the authoring layout: each route file holds its query with
the server function inline (markup in one twin, data in the other), and
`src/server/hn.ts` is a plain module behind `import "server-only"`, with
the boundary types referenced from `vite-env.d.ts` (TypeScript 6 rejects
the undeclared side-effect import). `lib/`, `api.ts`, `views.tsx` and
`components/toggle.tsx` go. `CommentDefinition` gains `id` and
`StoryDefinition.id` is a number, as the data carries.
The READMEs lead with the collapse, name their coordinates, and correct the
bundle check (grep the client JavaScript; `app.css` carries both class
names). A server spec pins the class-array form at a binding position on
both faces.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: hackernews server routes, nav outside Loading, router next.31
The feeds and the user page have no client half, so they become server
routes: `serverRouteComponent(query(...))`, with the router making the
call from the match on navigation and on link hover, so they need no route
component and no `preload`. The feeds are one `/:type?` route filtered to
the five feed names, with `page` read through a hand-written search schema.
The story route keeps its component because of the collapse fill. The nav
leaves the `Loading` boundary, since it does no I/O and the shell can wait
on it. The SPA twin uses the same route pattern and filter, and parses
`?page` itself.
Router 2.0.0-next.29 sent a schema-less server route's args as
`{ params, search: undefined }`. The JSON argument check rejects that, so
client navigation to the user page silently never happened. next.30
fixed it (#615), so every example that uses the router moves to next.31.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: hackernews collapse as native details, navigation dim
The collapse only hides replies, which is what <details> does natively, so
the binding slot was a heavier way to do what the browser already does.
Both twins now render the same <details> with a CSS label swap: the server
twin's thread has no client code, its story route becomes a server route
like the feeds and user page, and the SPA's Toggle component is deleted.
The toggle styles move to the <summary> so font sizes don't compound with
nesting. Markup stays byte-identical between the twins.
Both roots dim the page while a navigation is pending (`useIsRouting()`),
with a short delay so a navigation that hover preloading already made fast
never flickers. The old page stays up instead of going blank.
The plan records the revision, and that the occlusion proof (content a
client component doesn't place ships once, as a record) has had no demo or
end-to-end test since the early HN demo's deep-collapsed replies were
dropped.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: notes in React's shape, end-to-end occlusion specs
The notes demo moves to the authoring layout and toward the React
original. The shell is a client component, as App.js is; only the
sidebar list and the note preview are server components. The server
shell had existed only to host the search field as a binding slot, and
with the shell on the client the field is a plain client component. The
editor's data is a plain query (getNoteEdit) instead of a server
component used as a data loader. router.tsx holds the routes, the root
preload and getNoteList, and server-config.ts passes that Router to the
flight collector, as in the fullstack template.
The excerpt now mounts only while expanded, as in the demo, so a
collapsed excerpt ships once as an sc:region record and expanding it
makes no request. The list is newest first and the excerpt is the
rendered markdown as plain text, both matching the demo; the excerpt
renders on the server, so marked stays in the lazy editor chunk only.
The occlusion specs prove the single-copy claim end to end. The server
spec checks each excerpt ships once (markup where placed, a record where
not) and that late placement is locked to records. The hydration spec
adopts the document with the network stubbed to throw, then expands,
collapses and re-expands, with each text on screen once.
The README, the grid plan and the principles doc are updated: the
notes search field is no longer a binding-slot example, and the
hackernews occlusion gap is closed.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: todos README names its coordinate, small cleanups
The README opens with the example's place on the grid: the client-owned,
request/response corner beside hackernews-spa, twin of todos-server, and
the baseline for the planned board example. It points at todos.ts as the
file to read.
The todos.ts header keeps its instruction to read the file for its
layering rather than as a list of React-to-Solid renames, but drops the
rebuke. The error map moves from module scope into createTodos, so each
instance has its own; the unused TodoActions type goes; the row checkbox
uses onChange like toggle-all. Vite 7 -> 8, as in the other grid
examples. The grid plan marks todos built.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: todos-server as forms with binding slots, router next.34, vite-plugin next.47
todos-server rebuilt around forms: every control is a form that works
without JavaScript (`.with()` binds a row's id), and the server answers
the page it was posted from in one round trip. Two binding slots, `row`
and `list`, add back the optimism a form cannot express (toggle-all,
clear-completed, the live count) from one intent store the actions'
onSubmit hooks write. Failures are returned `{ error }` values read
through useSubmissions; the no-JS path reads the same answers from the
router's flash cookie. The README is rewritten around that shape.
Dependencies across the examples:
- @solidjs/router 2.0.0-next.34 in notes, room, hackernews,
hackernews-spa and todos-server (server-rendered `.with()` forms find
the registered action; the flash decode runs once per request).
- @solidjs/vite-plugin 3.0.0-next.47 in all eleven, so they compile with
the workspace compiler and babel plugin; next.47 is also the first to
inject the flash-cookie secret. effect, migrating-element, rendering and
sierpinski move to vite ^8, which next.47 requires (transformWithOxc).
The plan's verification note records V1-V4 holding and the two router
fixes they needed.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: router next.35
Actions now settle at the commit of their transition (#649): a form's
aria-busy, the onSettled hooks and the submission record release when the
result is on screen, not when the action body returns. Busy state is keyed
by the form's action URL, so it survives a server-component morph. Also
picks up the link-state fixes (aria-current compares the query, base path
on a segment boundary, non-ASCII paths).
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: todos-server shows intent through aria-busy, not an optimistic store
The list no longer predicts outcomes. While a form's submission is in
flight the router marks it aria-busy, and app.css shows the request from
that alone: a pressed toggle, a dimmed row, and through :has() every row
toggle-all or clear-completed touches. A mark waiting over two seconds
pulses. The server's answer replaces the mark; the SPA twin keeps the
predicting version.
Failures are answers the server words (it knows the todo's title): the
actions return { error } with the message, and the route lists them under
the list with a retry, cleared when the next attempt at the same thing
settles. The fills, the binding-slot bindings and the optimistic store are
gone; the list has no client code.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: todos-server dismisses errors a later success answered
A failed toggle's error stayed up after mark-all completed the todo, or
after the todo was deleted. A settled attempt already replaced earlier
answers to the same question within one action; now a successful delete
also dismisses that todo's toggle errors, and a successful mark-all
dismisses every row's.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: todos-server README names the render-mode condition for no-JS
Without JavaScript the page has to arrive whole: streamed content that
settles after the first flush needs a script to swap in. The example's
reads land before the flush, which is timing, not a guarantee; an app
that must work without JavaScript renders in the vite plugin's async
mode. Also brings the toggle snippet in line with the markup
(aria-pressed).
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: router next.37, server components mount through dynamicComponent
Every example moves to @solidjs/router 2.0.0-next.37, and the server
component mounts in chat, notes, room and todos-server use
dynamicComponent, the documented mount for a server component.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: hackernews routes answer cacheable GETs, no navigation dim
The server-components twin's routes are GET reads that answer through
respond(View, cacheable): a minute of public HTTP caching, so a link
hover's preload is the response the click then reads from the browser's
cache. Both twins drop the routing dim: the current page stays up until
the next is ready.
Depends on respond() being typed as its value and envelopes unwrapping
on the direct leg (#3910).
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: router 2.0.0-next.38, vite-plugin 3.0.0-next.48
Link preloading is opt-in in next.38, so each example's router passes
intentPreload() and keeps the hover, focus, and touch preload it had.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: vite-plugin 3.0.0-next.49
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples: record the grid handoff
The apps that exist are as far as the runtime can take them. The plan
names what landed, what stays, and what is handed off, and the chat,
room, and migrating-element READMEs say the same.
Co-authored-by: Grok via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* test(web): occlusion spec makes the regions tier resident before hydrate
The spec predates #3860, which moved `{$frame}` slot regions into the lazily
loaded regions tier: a record naming a region waits for the tier, so the slot
fills never mounted and expanding item a rendered nothing. Load it before
hydrate (as welcome-status-parity does for trace), assert the document
announces it, and re-record the artifact, which predated the announcement.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017PDt8Jv6uf5xRDsrux4UwF
---------
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Claude <[email protected]>1 parent 4101c67 commit bb66b43
92 files changed
Lines changed: 2168 additions & 1928 deletions
File tree
- documentation
- plans
- server-components
- examples
- chat
- src
- effect
- hackernews-spa
- src
- components
- lib
- routes
- server
- hackernews
- src
- components
- lib
- routes
- server
- migrating-element
- notes
- src
- components
- lib
- routes
- server
- rendering
- room
- src
- routes
- sierpinski
- todos-server
- src
- lib
- routes
- server
- todos
- src
- packages/web/test
- harness
- __artifacts__
- hydration
- server
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3183 | 3183 | | |
3184 | 3184 | | |
3185 | 3185 | | |
3186 | | - | |
| 3186 | + | |
3187 | 3187 | | |
3188 | 3188 | | |
3189 | 3189 | | |
| |||
4457 | 4457 | | |
4458 | 4458 | | |
4459 | 4459 | | |
4460 | | - | |
| 4460 | + | |
| 4461 | + | |
| 4462 | + | |
| 4463 | + | |
| 4464 | + | |
| 4465 | + | |
| 4466 | + | |
4461 | 4467 | | |
4462 | 4468 | | |
4463 | 4469 | | |
| |||
4494 | 4500 | | |
4495 | 4501 | | |
4496 | 4502 | | |
4497 | | - | |
| 4503 | + | |
4498 | 4504 | | |
4499 | 4505 | | |
4500 | 4506 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
| |||
87 | 93 | | |
88 | 94 | | |
89 | 95 | | |
90 | | - | |
| 96 | + | |
91 | 97 | | |
92 | 98 | | |
93 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | | - | |
| 22 | + | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | 269 | | |
273 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
274 | 276 | | |
275 | 277 | | |
276 | | - | |
| 278 | + | |
277 | 279 | | |
278 | 280 | | |
279 | 281 | | |
280 | 282 | | |
281 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
282 | 289 | | |
283 | 290 | | |
284 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | | - | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
39 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
40 | 48 | | |
41 | 49 | | |
42 | 50 | | |
| |||
0 commit comments