@molecule/app-query-solid 0.0.1-stage → 1.1.0

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
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-14T15:07:26.678Z
6
+ Generated: 2026-11-14T17:17:22.084Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-query-solid
@@ -289,18 +289,19 @@ function InvoicePage(props: { id: string }) {
289
289
  </p>
290
290
  )}
291
291
  >
292
- {(invoice) => <FlagButton invoice={invoice} viewer={viewer()} />}
292
+ {(invoice) => <FlagButton invoice={invoice()} viewer={viewer()} />}
293
293
  </QueryContent>
294
294
  )
295
295
  }
296
296
 
297
297
  function FlagButton(props: { invoice: Invoice; viewer: string }) {
298
298
  const { t } = useTranslation()
299
- const flag = useOptimisticValue({
299
+ // An accessor, so each saved or refreshed invoice syncs into the same controller.
300
+ const flag = useOptimisticValue(() => ({
300
301
  value: props.invoice.flagged,
301
- commit: async (on) =>
302
+ commit: async (on: boolean) =>
302
303
  (await invoices.toggle(props.viewer, props.invoice.id, 'flag', on)).flagged,
303
- })
304
+ }))
304
305
  return (
305
306
  <button type="button" aria-pressed={flag.value()} onClick={() => flag.update((on) => !on)}>
306
307
  {flag.value()
@@ -512,8 +513,12 @@ A loaded document owns its controls; absent documents expose only status content
512
513
  interface QueryContentProps<T> {
513
514
  /** State from useQuery, or any compatible query observer. */
514
515
  query: Pick<QueryState<T>, 'data' | 'status' | 'error'>
515
- /** Mounted only with a real document, including false, zero and an empty list. */
516
- children: (data: NonNullable<T>) => JSX.Element
516
+ /**
517
+ * Mounted only with a real document, including false, zero and an empty list. Runs once
518
+ * per loaded stretch with the document as an accessor (Solid's `<Show>` idiom): a new
519
+ * document reaches the same mounted content, so read it where it is used (`data()`).
520
+ */
521
+ children: (data: Accessor<NonNullable<T>>) => JSX.Element
517
522
  /** Initial idle/loading content. Render a status node, never a fake item or action. */
518
523
  pending?: JSX.Element
519
524
  /** Content for a loaded null record. Null is distinct from an unfinished request. */
@@ -592,6 +597,12 @@ Cached data remains mounted during refresh, including a failed refresh. Status f
592
597
  belong outside the list or record container rendered by `children`, and so does a refresh
593
598
  line; the default fallbacks render nothing.
594
599
 
600
+ `children` runs ONCE per loaded stretch and receives the document as an accessor (Solid's
601
+ `<Show>` idiom), so a new document — a cache publication, a refresh, another key's record —
602
+ reaches the SAME mounted content, the way React re-renders the same components with it:
603
+ their local state (an optimistic toggle's pending save, an open menu) survives. Read the
604
+ accessor where the value is used: `{(invoice) => <FlagButton invoice={invoice()} />}`.
605
+
595
606
  ```typescript
596
607
  function QueryContent<T>(props: QueryContentProps<T>): JSX.Element
597
608
  ```
@@ -768,6 +779,9 @@ Peer dependencies:
768
779
  Render resource-dependent lists and controls through {@link QueryContent}. Its child function
769
780
  receives only loaded, non-null data; loading and error content never mount item actions.
770
781
  It renders cached content during refresh and treats an empty list, false and zero as data.
782
+ The child runs once per loaded stretch and receives the document as an ACCESSOR (Solid's
783
+ `<Show>` idiom), so a saved or refreshed document reaches the same mounted controls, as React
784
+ re-renders them: call it where the value is read (`record()`), never once into a constant.
771
785
  Put the list, or the record's own container (its card, header or profile block), inside the
772
786
  child and every status line (loading, error, `isFetching` refresh) beside it, never inside it:
773
787
  a reader that finds the container and reads its paragraph must read the record, not "Loading…".
@@ -779,7 +793,7 @@ a reader that finds the container and reads its paragraph must read the record,
779
793
  missing={<p>{missingLabel}</p>}
780
794
  error={() => <p role="alert">{errorLabel}</p>}
781
795
  >
782
- {(record) => <RecordActions record={record} />}
796
+ {(record) => <RecordActions record={record()} />}
783
797
  </QueryContent>
784
798
  ```
785
799
 
package/dist/index.d.ts CHANGED
@@ -271,17 +271,19 @@
271
271
  * missing={<p role="alert">{t('invoice.missing', undefined, { defaultValue: 'Invoice not found.' })}</p>}
272
272
  * error={() => <p role="alert">{t('invoice.failed', undefined, { defaultValue: 'Unable to load invoice.' })}</p>}
273
273
  * >
274
- * {(invoice) => <FlagButton invoice={invoice} viewer={viewer()} />}
274
+ * {(invoice) => <FlagButton invoice={invoice()} viewer={viewer()} />}
275
275
  * </QueryContent>
276
276
  * )
277
277
  * }
278
278
  *
279
279
  * function FlagButton(props: { invoice: Invoice; viewer: string }) {
280
280
  * const { t } = useTranslation()
281
- * const flag = useOptimisticValue({
281
+ * // An accessor, so each saved or refreshed invoice syncs into the same controller.
282
+ * const flag = useOptimisticValue(() => ({
282
283
  * value: props.invoice.flagged,
283
- * commit: async (on) => (await invoices.toggle(props.viewer, props.invoice.id, 'flag', on)).flagged,
284
- * })
284
+ * commit: async (on: boolean) =>
285
+ * (await invoices.toggle(props.viewer, props.invoice.id, 'flag', on)).flagged,
286
+ * }))
285
287
  * return (
286
288
  * <button type="button" aria-pressed={flag.value()} onClick={() => flag.update((on) => !on)}>
287
289
  * {flag.value()
@@ -402,6 +404,9 @@
402
404
  * Render resource-dependent lists and controls through {@link QueryContent}. Its child function
403
405
  * receives only loaded, non-null data; loading and error content never mount item actions.
404
406
  * It renders cached content during refresh and treats an empty list, false and zero as data.
407
+ * The child runs once per loaded stretch and receives the document as an ACCESSOR (Solid's
408
+ * `<Show>` idiom), so a saved or refreshed document reaches the same mounted controls, as React
409
+ * re-renders them: call it where the value is read (`record()`), never once into a constant.
405
410
  * Put the list, or the record's own container (its card, header or profile block), inside the
406
411
  * child and every status line (loading, error, `isFetching` refresh) beside it, never inside it:
407
412
  * a reader that finds the container and reads its paragraph must read the record, not "Loading…".
@@ -409,7 +414,7 @@
409
414
  * ```tsx
410
415
  * <QueryContent query={query} pending={<p role="status">{loadingLabel}</p>}
411
416
  * missing={<p>{missingLabel}</p>} error={() => <p role="alert">{errorLabel}</p>}>
412
- * {(record) => <RecordActions record={record} />}
417
+ * {(record) => <RecordActions record={record()} />}
413
418
  * </QueryContent>
414
419
  * ```
415
420
  *
@@ -419,7 +424,7 @@
419
424
  *
420
425
  * @module
421
426
  */
422
- export * from './query-content.js';
427
+ export * from './query-content.jsx';
423
428
  export * from './resource.js';
424
429
  export * from './types.js';
425
430
  export * from './use-prefetch.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoaG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyaG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -271,17 +271,19 @@
271
271
  * missing={<p role="alert">{t('invoice.missing', undefined, { defaultValue: 'Invoice not found.' })}</p>}
272
272
  * error={() => <p role="alert">{t('invoice.failed', undefined, { defaultValue: 'Unable to load invoice.' })}</p>}
273
273
  * >
274
- * {(invoice) => <FlagButton invoice={invoice} viewer={viewer()} />}
274
+ * {(invoice) => <FlagButton invoice={invoice()} viewer={viewer()} />}
275
275
  * </QueryContent>
276
276
  * )
277
277
  * }
278
278
  *
279
279
  * function FlagButton(props: { invoice: Invoice; viewer: string }) {
280
280
  * const { t } = useTranslation()
281
- * const flag = useOptimisticValue({
281
+ * // An accessor, so each saved or refreshed invoice syncs into the same controller.
282
+ * const flag = useOptimisticValue(() => ({
282
283
  * value: props.invoice.flagged,
283
- * commit: async (on) => (await invoices.toggle(props.viewer, props.invoice.id, 'flag', on)).flagged,
284
- * })
284
+ * commit: async (on: boolean) =>
285
+ * (await invoices.toggle(props.viewer, props.invoice.id, 'flag', on)).flagged,
286
+ * }))
285
287
  * return (
286
288
  * <button type="button" aria-pressed={flag.value()} onClick={() => flag.update((on) => !on)}>
287
289
  * {flag.value()
@@ -402,6 +404,9 @@
402
404
  * Render resource-dependent lists and controls through {@link QueryContent}. Its child function
403
405
  * receives only loaded, non-null data; loading and error content never mount item actions.
404
406
  * It renders cached content during refresh and treats an empty list, false and zero as data.
407
+ * The child runs once per loaded stretch and receives the document as an ACCESSOR (Solid's
408
+ * `<Show>` idiom), so a saved or refreshed document reaches the same mounted controls, as React
409
+ * re-renders them: call it where the value is read (`record()`), never once into a constant.
405
410
  * Put the list, or the record's own container (its card, header or profile block), inside the
406
411
  * child and every status line (loading, error, `isFetching` refresh) beside it, never inside it:
407
412
  * a reader that finds the container and reads its paragraph must read the record, not "Loading…".
@@ -409,7 +414,7 @@
409
414
  * ```tsx
410
415
  * <QueryContent query={query} pending={<p role="status">{loadingLabel}</p>}
411
416
  * missing={<p>{missingLabel}</p>} error={() => <p role="alert">{errorLabel}</p>}>
412
- * {(record) => <RecordActions record={record} />}
417
+ * {(record) => <RecordActions record={record()} />}
413
418
  * </QueryContent>
414
419
  * ```
415
420
  *
@@ -419,7 +424,7 @@
419
424
  *
420
425
  * @module
421
426
  */
422
- export * from './query-content.js';
427
+ export * from './query-content.jsx';
423
428
  export * from './resource.js';
424
429
  export * from './types.js';
425
430
  export * from './use-prefetch.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoaG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyaG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
@@ -14,6 +14,12 @@ import type { QueryContentProps } from './types.js';
14
14
  * belong outside the list or record container rendered by `children`, and so does a refresh
15
15
  * line; the default fallbacks render nothing.
16
16
  *
17
+ * `children` runs ONCE per loaded stretch and receives the document as an accessor (Solid's
18
+ * `<Show>` idiom), so a new document — a cache publication, a refresh, another key's record —
19
+ * reaches the SAME mounted content, the way React re-renders the same components with it:
20
+ * their local state (an optimistic toggle's pending save, an open menu) survives. Read the
21
+ * accessor where the value is used: `{(invoice) => <FlagButton invoice={invoice()} />}`.
22
+ *
17
23
  * @param props - Query state, loaded content and optional status fallbacks.
18
24
  * @returns Loaded content or the appropriate fallback, switching as the state changes.
19
25
  */
@@ -1 +1 @@
1
- {"version":3,"file":"query-content.d.ts","sourceRoot":"","sources":["../src/query-content.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAc,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAexE"}
1
+ {"version":3,"file":"query-content.d.ts","sourceRoot":"","sources":["../src/query-content.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAc,KAAK,GAAG,EAAQ,MAAM,UAAU,CAAA;AAErD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAqBxE"}
@@ -5,7 +5,7 @@
5
5
  * and no styling, and renders exactly the chosen branch.
6
6
  * @module
7
7
  */
8
- import { createMemo } from 'solid-js';
8
+ import { createMemo, Show } from 'solid-js';
9
9
  /**
10
10
  * The loaded-data branch receives a non-null document. Pending, failed initial reads and
11
11
  * missing records never mount that branch, so its actions cannot swallow an early click.
@@ -13,24 +13,35 @@ import { createMemo } from 'solid-js';
13
13
  * belong outside the list or record container rendered by `children`, and so does a refresh
14
14
  * line; the default fallbacks render nothing.
15
15
  *
16
+ * `children` runs ONCE per loaded stretch and receives the document as an accessor (Solid's
17
+ * `<Show>` idiom), so a new document — a cache publication, a refresh, another key's record —
18
+ * reaches the SAME mounted content, the way React re-renders the same components with it:
19
+ * their local state (an optimistic toggle's pending save, an open menu) survives. Read the
20
+ * accessor where the value is used: `{(invoice) => <FlagButton invoice={invoice()} />}`.
21
+ *
16
22
  * @param props - Query state, loaded content and optional status fallbacks.
17
23
  * @returns Loaded content or the appropriate fallback, switching as the state changes.
18
24
  */
19
25
  export function QueryContent(props) {
20
- // The branch accessor returns the rendered branch (a node, `null`, or what a
21
- // render-function prop returned); Solid re-reads it as the state changes.
22
- const branch = createMemo(() => {
26
+ // Boxed, so a loaded `false`, `0` or `''` is still a truthy `when` for <Show>.
27
+ const loaded = createMemo(() => {
28
+ const data = props.query.data;
29
+ return data === undefined || data === null ? undefined : { data };
30
+ });
31
+ // Rendered only while nothing is loaded: a failed REFRESH of cached data never calls `error`.
32
+ const fallback = createMemo(() => {
23
33
  const query = props.query;
24
34
  const data = query.data;
25
- if (data === undefined) {
26
- return query.status === 'error' && props.error
27
- ? props.error(query.error)
28
- : (props.pending ?? null);
29
- }
30
35
  if (data === null)
31
36
  return props.missing ?? null;
32
- return props.children(data);
37
+ if (data !== undefined)
38
+ return null;
39
+ return query.status === 'error' && props.error
40
+ ? props.error(query.error)
41
+ : (props.pending ?? null);
33
42
  });
34
- return <>{branch}</>;
43
+ return (<Show when={loaded()} fallback={fallback()}>
44
+ {(box) => props.children(() => box().data)}
45
+ </Show>);
35
46
  }
36
47
  //# sourceMappingURL=query-content.jsx.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-content.jsx","sourceRoot":"","sources":["../src/query-content.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAY,MAAM,UAAU,CAAA;AAI/C;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAI,KAA2B;IACzD,6EAA6E;IAC7E,0EAA0E;IAC1E,MAAM,MAAM,GAAG,UAAU,CAAc,GAAG,EAAE;QAC1C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;QACvB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,KAAK,CAAC,MAAM,KAAK,OAAO,IAAI,KAAK,CAAC,KAAK;gBAC5C,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;gBAC1B,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,CAAA;QAC7B,CAAC;QACD,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC,OAAO,IAAI,IAAI,CAAA;QAC/C,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;IACF,OAAO,EAAE,CAAC,MAAM,CAAC,GAAG,CAAA;AACtB,CAAC"}
1
+ {"version":3,"file":"query-content.jsx","sourceRoot":"","sources":["../src/query-content.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAY,IAAI,EAAE,MAAM,UAAU,CAAA;AAIrD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAAI,KAA2B;IACzD,+EAA+E;IAC/E,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,EAAE;QAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAA;QAC7B,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAA;IACnE,CAAC,CAAC,CAAA;IACF,8FAA8F;IAC9F,MAAM,QAAQ,GAAG,UAAU,CAAc,GAAG,EAAE;QAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;QACvB,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC,OAAO,IAAI,IAAI,CAAA;QAC/C,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,IAAI,CAAA;QACnC,OAAO,KAAK,CAAC,MAAM,KAAK,OAAO,IAAI,KAAK,CAAC,KAAK;YAC5C,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;YAC1B,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;IACF,OAAO,CACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CACzC;MAAA,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAC5C;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC"}
package/dist/types.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * Solid `JSX`.
5
5
  * @module
6
6
  */
7
- import type { JSX } from 'solid-js';
7
+ import type { Accessor, JSX } from 'solid-js';
8
8
  import type { QueryState } from '@molecule/app-query';
9
9
  /**
10
10
  * A mounted query's state and its explicit cache and refresh actions. The state
@@ -36,8 +36,12 @@ export interface UseQueryResult<T> extends QueryState<T> {
36
36
  export interface QueryContentProps<T> {
37
37
  /** State from useQuery, or any compatible query observer. */
38
38
  query: Pick<QueryState<T>, 'data' | 'status' | 'error'>;
39
- /** Mounted only with a real document, including false, zero and an empty list. */
40
- children: (data: NonNullable<T>) => JSX.Element;
39
+ /**
40
+ * Mounted only with a real document, including false, zero and an empty list. Runs once
41
+ * per loaded stretch with the document as an accessor (Solid's `<Show>` idiom): a new
42
+ * document reaches the same mounted content, so read it where it is used (`data()`).
43
+ */
44
+ children: (data: Accessor<NonNullable<T>>) => JSX.Element;
41
45
  /** Initial idle/loading content. Render a status node, never a fake item or action. */
42
46
  pending?: JSX.Element;
43
47
  /** Content for a loaded null record. Null is distinct from an unfinished request. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IACtD;;;;;;;;;OASG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,SAAS,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,IAAI,CAAA;IAC1E;;;;;OAKG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;CACtC;AAED,wFAAwF;AACxF,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,6DAA6D;IAC7D,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAA;IACvD,kFAAkF;IAClF,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;IAC/C,uFAAuF;IACvF,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,qFAAqF;IACrF,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,GAAG,CAAC,OAAO,CAAA;CACxC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IACtD;;;;;;;;;OASG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,SAAS,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,IAAI,CAAA;IAC1E;;;;;OAKG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;CACtC;AAED,wFAAwF;AACxF,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,6DAA6D;IAC7D,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAA;IACvD;;;;OAIG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;IACzD,uFAAuF;IACvF,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,qFAAqF;IACrF,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,GAAG,CAAC,OAAO,CAAA;CACxC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-query-solid",
3
- "version": "0.0.1-stage",
3
+ "version": "1.1.0",
4
4
  "description": "Solid hooks for @molecule/app-query — read a cached document synchronously, observe it, and prefetch on intent",
5
5
  "homepage": "https://www.molecule.dev/packages/app-query-solid",
6
6
  "type": "module",
@@ -55,9 +55,9 @@
55
55
  "@molecule/app-query": "1.2.0",
56
56
  "@molecule/app-query-memory": "1.0.5",
57
57
  "@molecule/app-query-tanstack": "1.0.5",
58
- "@molecule/app-solid": "3.5.0",
58
+ "@molecule/app-solid": "3.6.0",
59
59
  "@molecule/app-ui": "1.3.11",
60
- "@molecule/app-ui-solid": "1.1.1",
60
+ "@molecule/app-ui-solid": "1.1.2",
61
61
  "@types/node": "26.6.5",
62
62
  "jsdom": "30.1.3",
63
63
  "solid-js": "1.9.17",