You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: align from-solid-router migration with the rewritten router guides
Preload examples start the query with void and read it through a memo
instead of reading props.data as an awaited value; the pending-submissions
example moves the optimistic store into the component, takes FormData, and
explains why .onSubmit reverts on settle; links to the new Data page.
Co-authored-by: Cursor <cursoragent@cursor.com>
In this example, `id` is `string` and `tab` is `string | undefined`.
309
307
Parameters inherited from a parent remain available as `string | undefined`.
310
308
309
+
Note the `void` in the preload.
310
+
In Router 1.x, `load` results were often read from the component through `createAsync`; in Router 2 the preload only starts the query, and the component reads the same query through a memo, as shown under [Replace async wrappers](#replace-async-wrappers).
311
+
`props.data` still holds whatever `preload` returns, captured once when the route matches, which makes it a poor fit for a promise that depends on `params`.
312
+
311
313
Use a path witness when the component is declared in another module:
The three concerns that `submission.pending` used to cover are now split: the optimistic store shows the new row, `aria-busy` styles the form, and `useSubmissions` reports the error.
501
+
`.onSubmit` runs inside the action's transaction, so the optimistic push reverts on its own when the action settles and `getTodos` revalidates.
502
+
Registering it inside the component ties the hook to the component's lifetime.
503
+
488
504
Router 2 retains a submission only when the action produces a result or error.
489
505
A void or metadata-only completion still reaches `.onSettled(...)`.
490
506
Keep `method="post"` on action forms, and give a server-rendered client action a stable name.
507
+
The rewritten [Data loading and mutations](/routing/solid-router/data#show-what-is-happening) page walks through this split with a running example.
491
508
492
509
### Move response helpers
493
510
@@ -630,16 +647,19 @@ Move route options into a named `route` export:
0 commit comments