@shivaedev/react 0.47.0 → 0.47.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.47.2 - 2026-11-11
4
+
5
+ ### Fixed
6
+
7
+ - A route whose component mounts after its loader read a query now continues the loader's subscription and first result, so the query handler runs once per page view, for live and `live: false` queries alike. `loadQuery` keeps a successful query mounted for a five-second hand-over window on the query runtime's `Clock`; a route that is left or never mounts releases it when the window passes.
8
+ - `screenPending()` settles while a live query is mounted. A live query still keeps the screen pending until its first answer arrives; its open subscription no longer keeps it pending forever.
9
+
10
+ ## 0.47.1 - 2026-11-10
11
+
12
+ ### Changed
13
+
14
+ - Update `@shivaedev/contract` from 0.43.4 to 0.43.5.
15
+ - Update `@shivaedev/identity` from 0.31.0 to 0.31.1.
16
+
3
17
  ## 0.47.0 - 2026-11-08
4
18
 
5
19
  ### Added
package/README.md CHANGED
@@ -32,7 +32,7 @@ An **editor** joins a query atom, a form field schema and a save Effect. The que
32
32
 
33
33
  Use `useConnectionStatus(client)` from `@shivaedev/react/client/adapters/useConnectionStatus.ts` with the client returned by contract's `makeClient`. It returns one `"live" | "reconnecting" | "waiting-for-connection"` value across mounted queries from every binding on that client's `Client` service. Live subscription status changes debounce for 300 ms on the client runtime's Clock. A bound command held for reconnection reports `"waiting-for-connection"` immediately, so the application can show Reconnecting while keeping the action pending. Contract holds unsent commands for up to 10 seconds and returns a typed `RpcClientError` on timeout; commands already sent are never replayed. The default socket probes Ping/Pong on browser or native resume and reconnects after 2.5 seconds without a Pong. A query refusal is separate from connectivity. Visible browser `online` and `visibilitychange` signals interrupt the live retry delay and reconnect immediately with a fresh backoff schedule.
34
34
 
35
- A **session generation** is the string returned by `identify(session)`. `SessionBoundary` owns its client, registry and React subtree. Your auth owner supplies the session and decides when to replace or end it. The boundary automatically mounts live connections on bound contract APIs returned by `connect`, directly or as client properties such as `api`. Use a Platform database host and the default shared WebSocket client; the application needs no subscribe handler or `live()` call. The process holding the socket reloads the session and runs the read policy and handler for each subscriber independently. It stores one encoded-result hash per subscribed query in memory and pushes changed values; equal reads acknowledge completion without replacing the screen. Each subscription has at most one rerun in flight and one pending, merging further changes while busy. Other subscriptions run independently in parallel. Backlog overflow and PostgreSQL listener recovery trigger a server `Resync`: the server reruns queries itself, and the client sends no follow-up reads. Query results stay in their native registry; RPC declarations and transport stay with native Effect and the application; this package supplies their React state and lifecycle boundary.
35
+ A **session generation** is the string returned by `identify(session)`. `SessionBoundary` owns its client, registry and React subtree. Your auth owner supplies the session and decides when to replace or end it. The boundary automatically mounts live connections on bound contract APIs returned by `connect`, directly or as client properties such as `api`. Use a Platform database host and the default shared WebSocket client; the application needs no subscribe handler or `live()` call. The process holding the socket reloads the session and runs the read policy and handler for each subscriber independently. It stores one encoded-result hash per subscribed query in memory and pushes changed values; equal reads acknowledge completion without replacing the screen. Each subscription has at most one rerun in flight and one pending, merging further changes while busy. Other subscriptions run independently in parallel. Backlog overflow triggers a server `Resync`: the server reruns queries itself, and the client sends no follow-up reads. Query results stay in their native registry; RPC declarations and transport stay with native Effect and the application; this package supplies their React state and lifecycle boundary.
36
36
 
37
37
  An explicit query refresh keeps the current data visible while reporting pending until the new subscription result arrives. Retryable connection failures keep that data visible during reconnection. Render read denials before retained data; replacing or ending the session disposes its registry.
38
38
 
@@ -94,7 +94,7 @@ A query that fails with an `Unauthorized` from `@shivaedev/errors/taxonomy.ts` a
94
94
 
95
95
  #### Session-scoped bindings
96
96
 
97
- A contract declared with `keyScope: "session"` keys its reads and invalidations by the signed-in account, and its binding requires the registry that owns the session's queries. The [contract guide](https://github.com/ShivaeDev/platform/blob/main/packages/contract/README.md#session-owned-keys) describes the declaration and its handlers. `SessionBoundary` passes that registry to `connect` as its second argument:
97
+ A contract declared with `keyScope: "session"` binds to the registry that owns the session's queries. In the browser, `bind` prefixes every client read and invalidation key of that contract with an opaque id of its registry, so a successful command in one session refreshes none of another session's queries on the page, even when both registries share one runtime. The server adds no prefix: its subscriptions and committed writes use plain keys, and each query's read policy decides what a viewer receives. The [contract guide](https://github.com/ShivaeDev/platform/blob/main/packages/contract/README.md#session-owned-keys) describes the declaration and its handlers. `SessionBoundary` passes that registry to `connect` as its second argument:
98
98
 
99
99
  ```tsx
100
100
  import { bind } from "@shivaedev/contract/bind.ts";
@@ -789,11 +789,11 @@ Without the corresponding callback, failures retain their normal error or not-fo
789
789
 
790
790
  For a loader that coordinates more work, use `loadQuery(registry, atom, loaderContext)` from `@shivaedev/react/adapters/loadQuery.ts` directly. It reads the atom in the supplied registry and throws typed failures unchanged, including `NotFound`; the loader decides how to handle them.
791
791
 
792
- `defaultPendingMs: Infinity` keeps the current route's data visible during navigation; the shell reads TanStack's `isLoading` to display pending state. The new route commits when its loader settles. This is TanStack's pending policy, separate from `useQuery`'s retained display. The loader and the component share one query execution even when the route delays mounting for 650 ms, beyond the registry’s idle window: the first render has the loaded value and the RPC handler runs once.
792
+ `defaultPendingMs: Infinity` keeps the current route's data visible during navigation; the shell reads TanStack's `isLoading` to display pending state. The new route commits when its loader settles. This is TanStack's pending policy, separate from `useQuery`'s retained display. The loader hands its query over to the route's component: the first render has the loaded value, and the query handler runs once, for a live subscription and for a `live: false` query alike, even when the route mounts after the registry’s idle window.
793
793
 
794
794
  `useLoaderQuery(atom, route.useLoaderData())` subscribes to the same atom and exposes `data` as its success type, with no `Option` or Initial result. Refetches keep the last value visible. `useQuery`, `useLoaderQuery` and a loader-backed editor’s `query` expose `denied: true` for `QueryReadDenied`, alongside the typed `cause`. Use this state to replace retained content with the application’s not-found screen after access is revoked. Refused live queries stay refused through change notifications until their input or viewer changes. For a loader-backed editor, pass the loader value as `useEditor({ ...config, loaded: route.useLoaderData() })`; its form is defined on the first render and `editor.query.data` is the row directly.
795
795
 
796
- `loadQuery` mounts its query only while the loader is running. Completed bound queries use the same retention policy as component reads, including its expiry, capacity and session ownership. A delayed route can show that kept value while its subscription revalidates. A returning route whose bound query still has a kept result renders it immediately as stale. Readers without data suspend until their active loader completes. Failed loaders also release execution; the route keeps its error visible and Retry starts a new load. Already mounted readers keep their data during refreshes.
796
+ `loadQuery` mounts its query while the loader runs and, once it succeeds, for a five-second hand-over window measured on the bound query's atom runtime `Clock`. A component that mounts within the window continues the loader's subscription and its first result instead of opening another. A route that is left or never mounts releases the query when the window passes; from then on the bound query uses the same retention policy as component reads, including its expiry, capacity and session ownership. A route that mounts after the window shows that kept value while a new subscription revalidates it. A returning route whose bound query still has a kept result renders it immediately as stale. Readers without data suspend until their active loader completes. Failed loaders also release execution; the route keeps its error visible and Retry starts a new load. Already mounted readers keep their data during refreshes.
797
797
 
798
798
  `loadQuery` returns an idle query’s kept success immediately while it revalidates. A refresh of an already mounted query still waits for its fresh result. Typed failures are thrown directly, so the route can inspect `_tag` rather than an Effect fiber wrapper. Defects remain failed Promises. TanStack's loader `abortController` cancels the waiting subscription and rejects with `name: "AbortError"`; other readers of the same query can still complete. The application owns the registry's lifetime and disposes it when its client or session ends. Use the same registry for router context and `RegistryContext.Provider`.
799
799
 
@@ -1214,7 +1214,7 @@ screenStories.it("shows the route failure", [], async () => {
1214
1214
 
1215
1215
  Story kits can acquire `captureReactWarnings` from `@shivaedev/test-story/client/adapters/react.ts` in their `create` effect with `const warnings = yield* captureReactWarnings`. The scope owns the capture and restores `console.error` when it closes, including after a failed story. Pass `warnings.onCaughtError` to `render` to capture boundary errors, or `warnings.expectCaughtError(predicate)` to exclude a declared error. Both handlers silence caught errors; the capture also silences and records `console.error` calls. `warnings.read()` returns `{ consoleErrors, caughtErrors }`, with each console call's arguments and the unexpected caught errors. It asserts nothing, leaving the story spec to state its expectation. The Vitest guard uses the same capture mechanism and additionally checks that every declared error occurred.
1216
1216
 
1217
- A screen kit tells its screen driver when the screen has finished its work with `screenPending({ router })` from `@shivaedev/react/adapters/screenPending.ts`. The Effect reads the `AtomRegistry` from its environment and returns a function that reports `true` while a native `AsyncResult` that something still reads is waiting, or while the optional TanStack router loads a route, and `false` otherwise. A result left waiting by a component that has unmounted does not count, even while the registry's idle window keeps its atom. Each call reads the registry and router at that moment, so pass it as the driver's `pending` option instead of listing the screen's queries by hand:
1217
+ A screen kit tells its screen driver when the screen has finished its work with `screenPending({ router })` from `@shivaedev/react/adapters/screenPending.ts`. The Effect reads the `AtomRegistry` from its environment and returns a function that reports `true` while a native `AsyncResult` that something still reads is waiting, or while the optional TanStack router loads a route, and `false` otherwise. A result left waiting by a component that has unmounted does not count, even while the registry's idle window keeps its atom. A mounted live query counts until its first answer arrives; after that its open subscription keeps nothing pending, so the screen settles while the live query stays mounted. Each call reads the registry and router at that moment, so pass it as the driver's `pending` option instead of listing the screen's queries by hand:
1218
1218
 
1219
1219
  ```ts
1220
1220
  const pending = yield* screenPending({ router }).pipe(Effect.provideService(AtomRegistry.AtomRegistry, view.registry));
@@ -12,9 +12,11 @@ export async function loadQuery(registry, atom, { abortController }) {
12
12
  await recheckUnauthorized(registry, result.failure);
13
13
  throw result.failure;
14
14
  }
15
+ handoff.handOver();
15
16
  return result.success;
16
17
  }
17
18
  catch (error) {
19
+ handoff.release();
18
20
  if (signal.aborted) {
19
21
  const canceled = new Error("Query loading canceled", { cause: error });
20
22
  canceled.name = "AbortError";
@@ -22,8 +24,5 @@ export async function loadQuery(registry, atom, { abortController }) {
22
24
  }
23
25
  throw error;
24
26
  }
25
- finally {
26
- handoff.complete();
27
- }
28
27
  }
29
28
  //# sourceMappingURL=loadQuery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadQuery.js","sourceRoot":"","sources":["../../src/adapters/loadQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5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E,QAAQ,CAAC,IAAI,GAAG,YAAY,CAAC;YAC7B,MAAM,QAAQ,CAAC;QAChB,CAAC;QACD,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC"}
@@ -1,7 +1,9 @@
1
- import type * as Atom from "effect/reactivity/Atom";
1
+ import * as Atom from "effect/reactivity/Atom";
2
2
  import type * as AtomRegistry from "effect/reactivity/AtomRegistry";
3
+ export declare const HAND_OVER_WINDOW = "5 seconds";
3
4
  export declare function keepLoaderQuery(registry: AtomRegistry.AtomRegistry, atom: Atom.Atom<unknown>, signal: AbortSignal): {
4
- complete: () => void;
5
+ handOver: () => void;
6
+ release: () => void;
5
7
  };
6
8
  export declare function pendingLoaderQuery(registry: AtomRegistry.AtomRegistry, atom: Atom.Atom<unknown>): Promise<void> | undefined;
7
9
  //# sourceMappingURL=queryHandoff.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queryHandoff.d.ts","sourceRoot":"","sources":["../../src/adapters/queryHandoff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,KAAK,YAAY,MAAM,gCAAgC,CAAC;AASpE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW;IAuBxG,QAAQ;EACjB;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAK3H"}
1
+ {"version":3,"file":"queryHandoff.d.ts","sourceRoot":"","sources":["../../src/adapters/queryHandoff.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAIpE,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAI5C,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW;;;EA+CjH;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAK3H"}
@@ -1,3 +1,9 @@
1
+ import { Effect } from "effect";
2
+ import * as AsyncResult from "effect/reactivity/AsyncResult";
3
+ import * as Atom from "effect/reactivity/Atom";
4
+ import { queryRuntime } from "@shivaedev/contract/retainQuery.ts";
5
+ // A route commits only after its slowest sibling loader and any pending minimum, so the window covers those; a cancelled navigation holds the query no longer.
6
+ export const HAND_OVER_WINDOW = "5 seconds";
1
7
  const handoffs = new WeakMap();
2
8
  export function keepLoaderQuery(registry, atom, signal) {
3
9
  let atoms = handoffs.get(registry);
@@ -9,24 +15,47 @@ export function keepLoaderQuery(registry, atom, signal) {
9
15
  atoms.set(atom, readers);
10
16
  const unmount = registry.mount(atom);
11
17
  const ready = Promise.withResolvers();
12
- const handoff = { ready: ready.promise, release };
13
- function release() {
14
- if (readers.delete(handoff)) {
18
+ let mounted = true;
19
+ let stopWindow;
20
+ function complete() {
21
+ if (readers.delete(ready.promise)) {
15
22
  ready.resolve();
23
+ }
24
+ }
25
+ function release() {
26
+ complete();
27
+ if (mounted) {
28
+ mounted = false;
29
+ stopWindow?.();
16
30
  signal.removeEventListener("abort", release);
17
31
  unmount();
18
32
  }
19
33
  }
20
- readers.add(handoff);
34
+ function handOver() {
35
+ complete();
36
+ const runtime = queryRuntime(atom);
37
+ if (runtime === undefined || !mounted) {
38
+ release();
39
+ return;
40
+ }
41
+ const timer = Atom.make((get) => {
42
+ const services = get(runtime);
43
+ if (AsyncResult.isSuccess(services)) {
44
+ get.addFinalizer(Effect.runCallbackWith(services.value)(Effect.sleep(HAND_OVER_WINDOW), { onExit: release }));
45
+ }
46
+ }).pipe(Atom.setIdleTTL(0));
47
+ stopWindow = registry.mount(timer);
48
+ }
49
+ readers.add(ready.promise);
21
50
  signal.addEventListener("abort", release, { once: true });
22
51
  if (signal.aborted) {
23
52
  release();
24
53
  }
25
- return { complete: release };
54
+ return { handOver, release };
26
55
  }
27
56
  export function pendingLoaderQuery(registry, atom) {
28
- for (const handoff of handoffs.get(registry)?.get(atom) ?? []) {
29
- return handoff.ready;
57
+ for (const ready of handoffs.get(registry)?.get(atom) ?? []) {
58
+ return ready;
30
59
  }
31
60
  return undefined;
32
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"queryHandoff.js","sourceRoot":"","sources":["../../src/adapters/queryHandoff.ts"],"names":[],"mappings":"AAQA,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAwE,CAAC;AAErG,MAAM,UAAU,eAAe,CAAC,QAAmC,EAAE,IAAwB,EAAE,MAAmB;IACjH,IAAI,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,KAAK,GAAG,IAAI,OAAO,EAAE,CAAC;QACtB,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAW,CAAC;IACtD,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACzB,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,EAAQ,CAAC;IAC5C,MAAM,OAAO,GAAY,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;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C,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACxC;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,GAAE,oBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,YAAY,CAAC,CAKnI"}
1
+ {"version":3,"file":"screenPending.d.ts","sourceRoot":"","sources":["../../src/adapters/screenPending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAG/D,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACxC;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,GAAE,oBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,YAAY,CAAC,CAMnI"}
@@ -1,8 +1,9 @@
1
1
  import { Effect, Option } from "effect";
2
2
  import * as AsyncResult from "effect/reactivity/AsyncResult";
3
3
  import * as AtomRegistry from "effect/reactivity/AtomRegistry";
4
+ import { isLiveConnection } from "@shivaedev/contract/live.ts";
4
5
  export function screenPending({ router } = {}) {
5
- return Effect.map(Effect.service(AtomRegistry.AtomRegistry), (registry) => () => routing(router) || [...registry.getNodes().values()].some((node) => waiting(node) && observed(node, new Set())));
6
+ return Effect.map(Effect.service(AtomRegistry.AtomRegistry), (registry) => () => routing(router) || [...registry.getNodes().values()].some((node) => waiting(node) && !isLiveConnection(node.atom) && observed(node, new Set())));
6
7
  }
7
8
  function routing(router) {
8
9
  return router !== undefined && (router.state.isLoading || router.state.matches.some((match) => match.isFetching !== false));
@@ -1 +1 @@
1
- {"version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AAC,MAAM,CAAC,KAAK,CAAC,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC;AAC7H,CAAC;AAED,SAAS,OAAO,CAAC,IAAgC;IAChD,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACxI,CAAC;AAED,qHAAqH;AACrH,SAAS,QAAQ,CAAC,IAAgC,EAAE,OAAwC;IAC3F,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAC5F,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/react",
3
- "version": "0.47.0",
3
+ "version": "0.47.2",
4
4
  "description": "React query, action, editor and session hooks for native Effect atoms",
5
5
  "keywords": [
6
6
  "effect"
@@ -45,41 +45,41 @@
45
45
  "README.md"
46
46
  ],
47
47
  "dependencies": {
48
- "@shivaedev/access": "0.6.2",
49
- "@shivaedev/contract": "0.43.4",
50
- "@shivaedev/errors": "0.11.0",
51
- "@shivaedev/form": "0.19.2",
52
- "@shivaedev/identity": "0.31.0"
48
+ "@shivaedev/access": "0.6.3",
49
+ "@shivaedev/contract": "0.44.0",
50
+ "@shivaedev/errors": "0.12.0",
51
+ "@shivaedev/form": "0.19.3",
52
+ "@shivaedev/identity": "0.31.2"
53
53
  },
54
54
  "devDependencies": {
55
- "@effect/atom-react": "4.1.1",
56
- "@effect/platform-node": "4.1.1",
57
- "@effect/sql-pg": "4.1.1",
58
- "@effect/sql-sqlite-node": "4.1.1",
59
- "@shivaedev/changes": "0.11.1",
60
- "@shivaedev/jobs": "0.42.1",
61
- "@shivaedev/quality": "0.75.0",
62
- "@shivaedev/server": "0.33.3",
63
- "@shivaedev/service": "0.9.0",
64
- "@shivaedev/sql": "0.46.4",
65
- "@shivaedev/test-kits": "0.11.0",
66
- "@shivaedev/test-sql": "0.24.8",
67
- "@shivaedev/test-story": "0.46.0",
55
+ "@effect/atom-react": "4.1.2",
56
+ "@effect/platform-node": "4.1.2",
57
+ "@effect/sql-pg": "4.1.2",
58
+ "@effect/sql-sqlite-node": "4.1.2",
59
+ "@shivaedev/changes": "0.12.0",
60
+ "@shivaedev/jobs": "0.42.2",
61
+ "@shivaedev/quality": "0.77.0",
62
+ "@shivaedev/server": "0.34.0",
63
+ "@shivaedev/service": "0.9.1",
64
+ "@shivaedev/sql": "0.47.0",
65
+ "@shivaedev/test-kits": "0.12.0",
66
+ "@shivaedev/test-sql": "0.24.9",
67
+ "@shivaedev/test-story": "0.47.0",
68
68
  "@tanstack/react-router": "1.170.46",
69
69
  "@types/node": "24.19.2",
70
70
  "@types/react": "19.3.0",
71
71
  "@types/react-dom": "19.3.0",
72
- "effect": "4.1.1",
72
+ "effect": "4.1.2",
73
73
  "happy-dom": "21.0.4",
74
74
  "react": "19.3.1",
75
75
  "react-dom": "19.3.1",
76
76
  "typescript": "7.0.2",
77
- "vitest": "5.0.5"
77
+ "vitest": "5.1.0"
78
78
  },
79
79
  "peerDependencies": {
80
- "@effect/atom-react": "4.1.1",
80
+ "@effect/atom-react": "4.1.2",
81
81
  "@tanstack/react-router": "1.170.46",
82
- "effect": "4.1.1",
82
+ "effect": "4.1.2",
83
83
  "react": "19.3.1"
84
84
  },
85
85
  "peerDependenciesMeta": {
@@ -23,15 +23,15 @@ export async function loadQuery<A, E>(
23
23
  await recheckUnauthorized(registry, result.failure);
24
24
  throw result.failure;
25
25
  }
26
+ handoff.handOver();
26
27
  return result.success;
27
28
  } catch (error) {
29
+ handoff.release();
28
30
  if (signal.aborted) {
29
31
  const canceled = new Error("Query loading canceled", { cause: error });
30
32
  canceled.name = "AbortError";
31
33
  throw canceled;
32
34
  }
33
35
  throw error;
34
- } finally {
35
- handoff.complete();
36
36
  }
37
37
  }
@@ -1,12 +1,13 @@
1
- import type * as Atom from "effect/reactivity/Atom";
1
+ import { Effect } from "effect";
2
+ import * as AsyncResult from "effect/reactivity/AsyncResult";
3
+ import * as Atom from "effect/reactivity/Atom";
2
4
  import type * as AtomRegistry from "effect/reactivity/AtomRegistry";
5
+ import { queryRuntime } from "@shivaedev/contract/retainQuery.ts";
3
6
 
4
- interface Handoff {
5
- readonly ready: Promise<void>;
6
- readonly release: () => void;
7
- }
7
+ // A route commits only after its slowest sibling loader and any pending minimum, so the window covers those; a cancelled navigation holds the query no longer.
8
+ export const HAND_OVER_WINDOW = "5 seconds";
8
9
 
9
- const handoffs = new WeakMap<AtomRegistry.AtomRegistry, WeakMap<Atom.Atom<unknown>, Set<Handoff>>>();
10
+ const handoffs = new WeakMap<AtomRegistry.AtomRegistry, WeakMap<Atom.Atom<unknown>, Set<Promise<void>>>>();
10
11
 
11
12
  export function keepLoaderQuery(registry: AtomRegistry.AtomRegistry, atom: Atom.Atom<unknown>, signal: AbortSignal) {
12
13
  let atoms = handoffs.get(registry);
@@ -14,29 +15,52 @@ export function keepLoaderQuery(registry: AtomRegistry.AtomRegistry, atom: Atom.
14
15
  atoms = new WeakMap();
15
16
  handoffs.set(registry, atoms);
16
17
  }
17
- const readers = atoms.get(atom) ?? new Set<Handoff>();
18
+ const readers = atoms.get(atom) ?? new Set<Promise<void>>();
18
19
  atoms.set(atom, readers);
19
20
  const unmount = registry.mount(atom);
20
21
  const ready = Promise.withResolvers<void>();
21
- const handoff: Handoff = { ready: ready.promise, release };
22
- function release() {
23
- if (readers.delete(handoff)) {
22
+ let mounted = true;
23
+ let stopWindow: (() => void) | undefined;
24
+ function complete() {
25
+ if (readers.delete(ready.promise)) {
24
26
  ready.resolve();
27
+ }
28
+ }
29
+ function release() {
30
+ complete();
31
+ if (mounted) {
32
+ mounted = false;
33
+ stopWindow?.();
25
34
  signal.removeEventListener("abort", release);
26
35
  unmount();
27
36
  }
28
37
  }
29
- readers.add(handoff);
38
+ function handOver() {
39
+ complete();
40
+ const runtime = queryRuntime(atom);
41
+ if (runtime === undefined || !mounted) {
42
+ release();
43
+ return;
44
+ }
45
+ const timer = Atom.make((get) => {
46
+ const services = get(runtime);
47
+ if (AsyncResult.isSuccess(services)) {
48
+ get.addFinalizer(Effect.runCallbackWith(services.value)(Effect.sleep(HAND_OVER_WINDOW), { onExit: release }));
49
+ }
50
+ }).pipe(Atom.setIdleTTL(0));
51
+ stopWindow = registry.mount(timer);
52
+ }
53
+ readers.add(ready.promise);
30
54
  signal.addEventListener("abort", release, { once: true });
31
55
  if (signal.aborted) {
32
56
  release();
33
57
  }
34
- return { complete: release };
58
+ return { handOver, release };
35
59
  }
36
60
 
37
61
  export function pendingLoaderQuery(registry: AtomRegistry.AtomRegistry, atom: Atom.Atom<unknown>): Promise<void> | undefined {
38
- for (const handoff of handoffs.get(registry)?.get(atom) ?? []) {
39
- return handoff.ready;
62
+ for (const ready of handoffs.get(registry)?.get(atom) ?? []) {
63
+ return ready;
40
64
  }
41
65
  return undefined;
42
66
  }
@@ -2,6 +2,7 @@ import type { AnyRouter } from "@tanstack/react-router";
2
2
  import { Effect, Option } from "effect";
3
3
  import * as AsyncResult from "effect/reactivity/AsyncResult";
4
4
  import * as AtomRegistry from "effect/reactivity/AtomRegistry";
5
+ import { isLiveConnection } from "@shivaedev/contract/live.ts";
5
6
 
6
7
  export interface ScreenPendingOptions {
7
8
  readonly router?: AnyRouter | undefined;
@@ -10,7 +11,8 @@ export interface ScreenPendingOptions {
10
11
  export function screenPending({ router }: ScreenPendingOptions = {}): Effect.Effect<() => boolean, never, AtomRegistry.AtomRegistry> {
11
12
  return Effect.map(
12
13
  Effect.service(AtomRegistry.AtomRegistry),
13
- (registry) => () => routing(router) || [...registry.getNodes().values()].some((node) => waiting(node) && observed(node, new Set())),
14
+ (registry) => () =>
15
+ routing(router) || [...registry.getNodes().values()].some((node) => waiting(node) && !isLiveConnection(node.atom) && observed(node, new Set())),
14
16
  );
15
17
  }
16
18