@jsenv/navi 0.29.225 → 0.29.226
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/dev/jsenv_navi.js +8 -7
- package/dist/dev/jsenv_navi.js.map +2 -2
- package/dist/jsenv_navi.js +8 -7
- package/dist/jsenv_navi.js.map +2 -2
- package/docs/AI_INSTRUCTIONS.md +7 -6
- package/docs/dynamic_import.md +63 -39
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ How to declare routes, render them, and turn them into tabs — including `Route
|
|
|
14
14
|
|
|
15
15
|
Actions are async operations with lifecycle management — pending, success, error. You can declare actions that run when navigating to a route, and any component can subscribe to them via `useAsyncData` to reflect what is happening: loading states, results, errors. No manual wiring.
|
|
16
16
|
|
|
17
|
+
Code loaded on demand is the same thing: a page's `import()` is a route action, started with the page's data on the url change and prefetched when a link to it is hovered or focused; a component inside a page that stays reads its own with `useAsyncData(() => import(…))`. One wait, one failure, no lazy-shaped API. See [docs/dynamic_import.md](./docs/dynamic_import.md).
|
|
18
|
+
|
|
17
19
|
## REST state
|
|
18
20
|
|
|
19
21
|
`resource()` turns a REST endpoint into a reactive store: one action per verb, a
|
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -31284,22 +31284,23 @@ const routeAction = (
|
|
|
31284
31284
|
|
|
31285
31285
|
// The instance the effect above runs on the match is the one bound to `true`
|
|
31286
31286
|
// (the default params), so a prerun here is what the arrival promotes to a
|
|
31287
|
-
// run. A prefetch that fails is
|
|
31288
|
-
//
|
|
31287
|
+
// run. A prefetch that fails is not reported: nothing on screen asked for it,
|
|
31288
|
+
// and the failure stays on the instance, where a run asks again — a FAILED
|
|
31289
|
+
// action is run, only RUNNING and COMPLETED are left alone — and the arrival
|
|
31290
|
+
// shows its own. It is left FAILED on purpose, not reset: the press that
|
|
31291
|
+
// brings the arrival also focuses the link, so a prerun can be in flight when
|
|
31292
|
+
// the arrival promotes it, and a reset landing after that would pull the
|
|
31293
|
+
// answer from under the page that is reading it.
|
|
31289
31294
|
const prefetchParamless = (action) => {
|
|
31290
31295
|
const instance = action.bindParams(true);
|
|
31291
|
-
const forget = () => {
|
|
31292
|
-
instance.reset({ reason: "prefetch failed" });
|
|
31293
|
-
};
|
|
31294
31296
|
let result;
|
|
31295
31297
|
try {
|
|
31296
31298
|
result = instance.prerun({ reason: "intent" });
|
|
31297
31299
|
} catch {
|
|
31298
|
-
forget();
|
|
31299
31300
|
return;
|
|
31300
31301
|
}
|
|
31301
31302
|
if (result && typeof result.catch === "function") {
|
|
31302
|
-
result.catch(
|
|
31303
|
+
result.catch(() => {});
|
|
31303
31304
|
}
|
|
31304
31305
|
};
|
|
31305
31306
|
|