@jsenv/navi 0.30.25 → 0.30.26

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/docs/actions.md CHANGED
@@ -229,6 +229,10 @@ delay to hide it:
229
229
 
230
230
  A "check now" wired to `run()` therefore checks nothing, silently.
231
231
 
232
+ `run()`, `rerun()` and `prerun()` answer the way the callback does: a promise when it is asynchronous, even
233
+ when `run()` joins an answer the instance already holds, so `ACTION.run().catch(…)`
234
+ holds in every state; the data itself, synchronously, when it is synchronous.
235
+
232
236
  ### Aborting saves resources, it does not undo
233
237
 
234
238
  `abort()` cancels what can still be cancelled — a `fetch` wired to the
@@ -112,6 +112,24 @@ render.**
112
112
  };
113
113
  ```
114
114
 
115
+ The binding `actionRunEffect` returns holds the state's question: while the
116
+ state says no, it has nothing to ask, and a reader on it waits forever. That
117
+ is right when the state is the only thing that asks. When something else asks
118
+ too (a reader with `run: true` that does not follow that state, the code of a
119
+ section every profile with cups draws, asked ahead because mine has some),
120
+ the effect runs the action and the readers read the question that always
121
+ stands, `true` for a param-less action. Both are the same instance, so the
122
+ code is fetched once:
123
+
124
+ ```jsx
125
+ const PALMARES_CODE_ACTION = createAction(() =>
126
+ import("./palmares.jsx").then((m) => m.Palmares),
127
+ );
128
+ actionRunEffect(PALMARES_CODE_ACTION, () => myCupsSignal.value.length > 0);
129
+ const PALMARES_CODE = PALMARES_CODE_ACTION.bindParams(true);
130
+ // useAsyncData(PALMARES_CODE, { run: hasPalmares, loading: true })
131
+ ```
132
+
115
133
  3. **Nothing above the component asks** → `useAsyncData` with a function, the
116
134
  fallback: the component's own existence is the only thing that asks, so the
117
135
  request is its own, for the life of the instance.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/navi",
3
- "version": "0.30.25",
3
+ "version": "0.30.26",
4
4
  "type": "module",
5
5
  "description": "Library of components including navigation to create frontend applications",
6
6
  "repository": {