@tinkered/react 0.31.12 → 0.31.13

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 CHANGED
@@ -198,10 +198,12 @@ This appendix states each behaviour the seam tests pin, one line per promise, gr
198
198
  - The subtree uses the exact app-owned scope, which the provider never closes.
199
199
  - Under StrictMode, create mode leaks no scope and never exposes a closed one.
200
200
  - A new scope on the provider mounts its subtree again.
201
+ - A new starting root on the provider shows that root's values.
202
+ - An Activity hide closes the created scope; a show renders only with a fresh one.
201
203
 
202
204
  ### useScope
203
205
 
204
- - A hook used with no provider raises NoProvider.
206
+ - useScope, useResource, useRelease, and SessionProvider used with no provider raise NoProvider.
205
207
 
206
208
  ### useData
207
209
 
@@ -224,6 +226,8 @@ This appendix states each behaviour the seam tests pin, one line per promise, gr
224
226
  - A write after unmount neither updates the removed subtree nor breaks the still-open scope.
225
227
  - A component reads a keyed resource, keeps its reference across renders, and follows a write.
226
228
  - A new config leaves the old entry.
229
+ - A new cell with an inline selector shows and follows that cell.
230
+ - A server render gives a pair for writable options alone.
227
231
 
228
232
  ### useResource
229
233
 
@@ -240,6 +244,7 @@ This appendix states each behaviour the seam tests pin, one line per promise, gr
240
244
  - Reading through a new scope builds in the new scope.
241
245
  - A synchronous build commits on the first flushed render with no suspend.
242
246
  - The hook returns the exact instance core cached for the owner.
247
+ - Builds dropped by refetch that settle after the newest one never replace its result.
243
248
 
244
249
  ### Capsule components
245
250
 
@@ -278,6 +283,7 @@ This appendix states each behaviour the seam tests pin, one line per promise, gr
278
283
  - A run with only onSettled reports failure without onError.
279
284
  - A run with empty options resolves runAsync without callbacks.
280
285
  - onError and onSettled fire with the failure and the call.
286
+ - A run that settles while an Activity hides the view shows its result when shown again.
281
287
 
282
288
  ### SessionProvider
283
289
 
@@ -285,6 +291,7 @@ This appendix states each behaviour the seam tests pin, one line per promise, gr
285
291
  - Switching the parent scope never exposes the old session, even if the old parent is closed.
286
292
  - A session-target resource is one instance per SessionProvider; siblings are distinct.
287
293
  - A scope-target resource is the same instance across sibling sessions.
294
+ - An Activity hide closes the session; a show renders only with a fresh one.
288
295
 
289
296
  ### Namespace reset
290
297
 
@@ -298,6 +305,7 @@ This appendix states each behaviour the seam tests pin, one line per promise, gr
298
305
  - A chain refetch clears its head and reuses its fallback.
299
306
  - A named session can still refetch a shared scope resource.
300
307
  - An explicit reset key still releases a shared scope resource.
308
+ - A reset follows a new explicit key without remounting.
301
309
  - An independent borrowed scope clears an outer session's reset key.
302
310
  - An independent owned scope clears an outer session's reset key.
303
311
  - A field reset keeps the form owner, other fields, and hook identities.
package/dist/index.d.mts CHANGED
@@ -38,9 +38,9 @@ export declare function ScopeProvider(props: ScopeProviderProps): ReactNode;
38
38
  * under it resolve against the session (the nearest `Handle`), so a `data` write is shadowed and does
39
39
  * not reach the parent. Created in an effect (StrictMode-safe, like {@link ScopeProvider}'s `create`
40
40
  * mode): StrictMode's first mount closes its session, which no render used yet, and the next live
41
- * mount opens a fresh one; a replay after the children rendered keeps the session (see below). The
42
- * session is published paired with the parent it belongs to; if the nearest scope changes, the old
43
- * session is never exposed for the new parent (render null until the effect opens a fresh one).
41
+ * mount opens a fresh one; a replay after the children rendered keeps the session (see below). A
42
+ * new nearest scope mounts this provider again (ADR 0144), so a session is never shown under
43
+ * another parent.
44
44
  * The reset namespace head is saved with this session, including an inherited key.
45
45
  * `options` apply when the session is created — changing them for the same parent has no effect until
46
46
  * the provider remounts.
package/dist/index.mjs CHANGED
@@ -115,9 +115,9 @@ function ScopeProvider(props) {
115
115
  * under it resolve against the session (the nearest `Handle`), so a `data` write is shadowed and does
116
116
  * not reach the parent. Created in an effect (StrictMode-safe, like {@link ScopeProvider}'s `create`
117
117
  * mode): StrictMode's first mount closes its session, which no render used yet, and the next live
118
- * mount opens a fresh one; a replay after the children rendered keeps the session (see below). The
119
- * session is published paired with the parent it belongs to; if the nearest scope changes, the old
120
- * session is never exposed for the new parent (render null until the effect opens a fresh one).
118
+ * mount opens a fresh one; a replay after the children rendered keeps the session (see below). A
119
+ * new nearest scope mounts this provider again (ADR 0144), so a session is never shown under
120
+ * another parent.
121
121
  * The reset namespace head is saved with this session, including an inherited key.
122
122
  * `options` apply when the session is created — changing them for the same parent has no effect until
123
123
  * the provider remounts.
@@ -139,17 +139,12 @@ function SessionProvider(props) {
139
139
  useEffect(() => {
140
140
  const released = releasedRef.current;
141
141
  releasedRef.current = void 0;
142
- if (released !== void 0 && released.parent === parent && released.inherited === inherited) return () => release(released);
143
- if (released !== void 0) closeScope(released.bound.scope);
142
+ if (released !== void 0) return () => release(released);
144
143
  const options = optionsRef.current;
145
144
  const session = parent.createSession(options);
146
145
  const ns = options?.ns;
147
146
  const [head] = ns === void 0 ? [inherited] : "tags" in ns ? [ns] : ns;
148
- const next = {
149
- parent,
150
- inherited,
151
- bound: bind(session, head)
152
- };
147
+ const next = bind(session, head);
153
148
  setOwned(next);
154
149
  return () => release(next);
155
150
  }, [parent, inherited]);
@@ -161,18 +156,18 @@ function SessionProvider(props) {
161
156
  function release(current) {
162
157
  if (renderedRef.current !== current) {
163
158
  setOwned(void 0);
164
- return closeScope(current.bound.scope);
159
+ return closeScope(current.scope);
165
160
  }
166
161
  releasedRef.current = current;
167
162
  queueMicrotask(() => {
168
163
  if (releasedRef.current !== current) return;
169
164
  releasedRef.current = void 0;
170
165
  setOwned(void 0);
171
- closeScope(current.bound.scope);
166
+ closeScope(current.scope);
172
167
  });
173
168
  }
174
- if (owned === void 0 || owned.parent !== parent) return null;
175
- return provide(owned.bound, props.children);
169
+ if (owned === void 0) return null;
170
+ return provide(owned, props.children);
176
171
  }
177
172
  /** Read the nearest scope `Handle`. Raises `NoProvider` when used outside a {@link ScopeProvider}. */
178
173
  function useScope() {
@@ -395,7 +390,7 @@ function useResource(handle, options = QUERY_OPTIONS) {
395
390
  const ref = useRef(void 0);
396
391
  if (options.suspense !== false) return useSuspendedResource(scope, handle, ns);
397
392
  let owner = ref.current;
398
- if (owner === void 0 || owner.scope !== scope || owner.handle !== handle || owner.ns !== ns) owner = ref.current = new ResourceOwner(scope, handle, ns, force);
393
+ if (owner === void 0 || owner.handle !== handle || owner.ns !== ns) owner = ref.current = new ResourceOwner(scope, handle, ns, force);
399
394
  owner.inherited = inherited;
400
395
  return useQueryResource(owner);
401
396
  }
@@ -596,7 +591,7 @@ function useRun(op, options) {
596
591
  const [, force] = useReducer(RunOwner.bump, 0);
597
592
  const ref = useRef(void 0);
598
593
  let owner = ref.current;
599
- if (owner === void 0 || owner.scope !== scope || owner.op !== op) {
594
+ if (owner === void 0 || owner.op !== op) {
600
595
  if (owner !== void 0) owner.options = void 0;
601
596
  owner = ref.current = new RunOwner(scope, op, force);
602
597
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinkered/react",
3
- "version": "0.31.12",
3
+ "version": "0.31.13",
4
4
  "description": "Tinkered React: a thin React adapter over @tinkered/core.",
5
5
  "keywords": [
6
6
  "tanstack-intent"
@@ -29,12 +29,12 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@tinkered/core": "^0.31.12"
32
+ "@tinkered/core": "^0.31.13"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@stryker-mutator/core": "^10.0.0",
36
36
  "@stryker-mutator/vitest-runner": "^10.0.0",
37
- "@tinkered/core": "^0.31.12",
37
+ "@tinkered/core": "^0.31.13",
38
38
  "@types/node": "^26.1.1",
39
39
  "@types/react": "^19",
40
40
  "@types/react-dom": "^19",
@@ -15,7 +15,7 @@ metadata:
15
15
  type: framework
16
16
  framework: react
17
17
  library: '@tinkered/react'
18
- library_version: '0.31.12'
18
+ library_version: '0.31.13'
19
19
  requires:
20
20
  - '@tinkered/core#core'
21
21
  sources: