Vue, Solid & Svelte Order Boards
The same small app written three times, once per adapter, on one shared model. It shows the four flows the adapter subpaths cover:
| Flow | Where to look | API |
|---|---|---|
| Per-scope state | shared/model.ts |
scoped(), useScoped() |
| Scope lifetime and hydration | each main.ts (Svelte: svelte/Root.svelte) |
ScopeProvider without a scope, HydrationBoundary, useHydrate |
| Optimistic mutation | App.vue, App.svelte, solid/main.ts |
useOptimisticAction |
| Lists | same files | useCollectionTopK, useCollectionSize |
| Async data | same files | useResource on a lazy resource |
What the page does:
- The balance reads 1,000 on the first render: the provider creates a scope and the snapshot
{ balance: 1000 }is hydrated into it before any component reads. - The profile shows
loadinguntil the lazy resource answers. The request starts when the first component reads it. - Reserve 150 lowers the balance at once and shows
pending. When the server answers, the layer is replaced by the server’s balance in one step. - Reserve 100000 is refused by the server. The optimistic edit is reverted and the error is shown.
- Pressing both quickly opens two layers. They rebase in creation order and settle independently.
- Add order inserts a row; the Top-3 list and the total update incrementally.
React has its own example, the WASM order book.
From the repository root, with the pinned toolchains installed:
pnpm install --frozen-lockfile --ignore-scriptsmise run build:tsmise run test:adapter-examplespython3 -m http.server 8080 --bind 127.0.0.1 --directory examples/adapter-orders/distOpen http://127.0.0.1:8080/vue/, /solid/ or /svelte/. The second task bundles the three views into dist/ and runs smoke.mjs, which mounts each view in happy-dom and drives the six steps above through the DOM.
How it is built
Section titled “How it is built”build.mjs uses the bundler and compilers the test workspace already installs (Rolldown, vue/compiler-sfc, svelte/compiler), so the example adds no toolchain of its own. That is also why the Solid view builds its DOM with a small el() helper instead of JSX: no JSX compiler for Solid 2 is installed here. In an application, write it with your usual Solid setup; the zwire calls are the same.