@jsenv/navi 0.29.90 → 0.29.91

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.
@@ -162,7 +162,11 @@ consistency across the app, not from any single call site.
162
162
  the bounds of a span PUSH each other while they turn (`minDuration`) instead
163
163
  of being refused at send, and `placeholder` is a position shown without being
164
164
  an answer — for a span that is optional ("any time of day") on wheels that
165
- have no blank row to land on. Read this before writing a time input, and
165
+ have no blank row to land on. A clear (or a value written as `undefined`) puts
166
+ such a pair back on its placeholder and back to answering nothing, so a row's
167
+ cross means what it says. `hours` bounds what the wheels offer
168
+ (`{ min: 7, max: 21 }`, or the list itself) — rows nobody can land on are rows
169
+ in the way. Read this before writing a time input, and
166
170
  before making a pair of wheels say "nothing set" by hand.
167
171
  - `docs/control_group.md` — `<Group>`: several controls reading as one framed
168
172
  object (one border per seam, radius on the outer corners only). Read it
package/docs/actions.md CHANGED
@@ -72,6 +72,16 @@ const userAction = getUser.bindParams({ id: userIdSignal });
72
72
  | `reset()` | Aborts what is running and puts the action back to idle, data and all. |
73
73
  | `abort()` | Calls off the run in flight, keeping the data it had. |
74
74
 
75
+ ### Aborting saves resources, it does not undo
76
+
77
+ `abort()` cancels what can still be cancelled — a `fetch` wired to the
78
+ callback's `signal` — and nothing more. The server may have done the work
79
+ before the cancellation reached it, or may not honor cancellations at all:
80
+ whether the work happened is known from the run's settlement alone. For that
81
+ reason a run's promise settles only when its callback settles, even after an
82
+ abort, and anything sequenced behind a run — an optimistic control's queued
83
+ request, for instance — waits for that settlement, never for the abort.
84
+
75
85
  ## Reading an action
76
86
 
77
87
  ```jsx
@@ -10,6 +10,7 @@ somewhere else in the app.
10
10
  - [What a signal holds, control by control](#what-a-signal-holds-control-by-control)
11
11
  - [Empty keeps the shape of the question](#empty-keeps-the-shape-of-the-question)
12
12
  - [Which controls take a `signal`](#which-controls-take-a-signal)
13
+ - [The PROP is what controls, not its value](#the-prop-is-what-controls-not-its-value)
13
14
  - [`value` and `signal` exclude each other](#value-and-signal-exclude-each-other)
14
15
  - [A `stateSignal` brings more than a value](#a-statesignal-brings-more-than-a-value)
15
16
 
@@ -160,6 +161,28 @@ own `selected` — but not expect the two to arbitrate. An item that declares
160
161
  it. On screen that reads as a list where clicking does nothing, so navi says it
161
162
  in dev the moment the two claims meet: bind one end or the other, not both.
162
163
 
164
+ ## The PROP is what controls, not its value
165
+
166
+ `value` (and `checked`, and a row's `selected`) makes a control controlled by
167
+ being **there**. Its value is a separate question: `value={undefined}` says "I
168
+ hold this one, and right now it holds nothing" — the control shows nothing, and
169
+ nothing else can fill it. That is a real state and it is the one asked for.
170
+
171
+ The trap is the shorthand for an optional prop:
172
+
173
+ ```jsx
174
+ // WRONG — the key is always there, so the control is always controlled,
175
+ // and the group above it can never fill it
176
+ <Input checked={bound ? undefined : checked} />
177
+
178
+ // RIGHT — the prop is there only when you are the one answering
179
+ <Input {...(bound ? {} : { checked })} />
180
+ ```
181
+
182
+ Passing a prop the code knows will always be `undefined` is the same mistake
183
+ written once instead of twice: leave it out. navi says so in dev when a group
184
+ tries to place a child that has claimed itself this way.
185
+
163
186
  ## `value` and `signal` exclude each other
164
187
 
165
188
  `value` (or `checked`) says "you hold it", `signal` says "the signal holds it".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/navi",
3
- "version": "0.29.90",
3
+ "version": "0.29.91",
4
4
  "type": "module",
5
5
  "description": "Library of components including navigation to create frontend applications",
6
6
  "repository": {