@molecule/app-query-svelte 1.3.0 → 1.3.1
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 +5 -4
- package/dist/QueryContent.svelte +4 -3
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
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-
|
|
6
|
+
Generated: 2026-11-17T05:19:22.368Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-query-svelte
|
|
@@ -447,7 +447,8 @@ interface QueryContentProps<T> {
|
|
|
447
447
|
/**
|
|
448
448
|
* One optional empty branch, exclusive with children. The pure predicate reads the
|
|
449
449
|
* loaded document (an array or an application-owned envelope); render selects the
|
|
450
|
-
* current view's message and recovery action.
|
|
450
|
+
* current view's message and recovery action. A previous key's empty document uses
|
|
451
|
+
* pending/error instead. Omit it to keep empty arrays as data.
|
|
451
452
|
*/
|
|
452
453
|
empty?: {
|
|
453
454
|
when: (data: NonNullable<T>) => boolean
|
|
@@ -459,8 +460,8 @@ interface QueryContentProps<T> {
|
|
|
459
460
|
* compatible observer's plain state object. Both follow the query.
|
|
460
461
|
*/
|
|
461
462
|
query:
|
|
462
|
-
| Readable<Pick<QueryState<T>, 'data' | 'status' | 'error'>>
|
|
463
|
-
| Pick<QueryState<T>, 'data' | 'status' | 'error'>
|
|
463
|
+
| Readable<Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>>
|
|
464
|
+
| Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>
|
|
464
465
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
465
466
|
children: Snippet<[NonNullable<T>]>
|
|
466
467
|
/** Initial idle/loading content. Render a status snippet, never a fake item or action. */
|
package/dist/QueryContent.svelte
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
refresh, including a failed refresh. Status fallbacks belong outside the
|
|
8
8
|
list or record container rendered by `children`, and so does a refresh
|
|
9
9
|
line; the default fallbacks render nothing. Headless: it owns no
|
|
10
|
-
translations and no styling.
|
|
10
|
+
translations and no styling. A previous key's empty or missing document
|
|
11
|
+
renders pending/error until the current key answers.
|
|
11
12
|
-->
|
|
12
13
|
<script lang="ts" generics="T">
|
|
13
14
|
import { type Readable, readonly, writable } from 'svelte/store'
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
import type { QueryContentProps } from './types.js'
|
|
18
19
|
|
|
19
20
|
/** The part of a query state this component renders from. */
|
|
20
|
-
type QueryView = Pick<QueryState<T>, 'data' | 'status' | 'error'>
|
|
21
|
+
type QueryView = Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>
|
|
21
22
|
|
|
22
23
|
let {
|
|
23
24
|
query,
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
)
|
|
42
43
|
</script>
|
|
43
44
|
|
|
44
|
-
{#if $view.data === undefined}
|
|
45
|
+
{#if $view.data === undefined || ($view.isPreviousData && ($view.data === null || empty?.when($view.data)))}
|
|
45
46
|
{#if $view.status === 'error' && error}
|
|
46
47
|
{@render error($view.error)}
|
|
47
48
|
{:else if pending}
|
package/dist/types.d.ts
CHANGED
|
@@ -37,7 +37,8 @@ export interface QueryContentProps<T> {
|
|
|
37
37
|
/**
|
|
38
38
|
* One optional empty branch, exclusive with children. The pure predicate reads the
|
|
39
39
|
* loaded document (an array or an application-owned envelope); render selects the
|
|
40
|
-
* current view's message and recovery action.
|
|
40
|
+
* current view's message and recovery action. A previous key's empty document uses
|
|
41
|
+
* pending/error instead. Omit it to keep empty arrays as data.
|
|
41
42
|
*/
|
|
42
43
|
empty?: {
|
|
43
44
|
when: (data: NonNullable<T>) => boolean;
|
|
@@ -47,7 +48,7 @@ export interface QueryContentProps<T> {
|
|
|
47
48
|
* State from `useQuery` — as the readable store the hook returns, or as a
|
|
48
49
|
* compatible observer's plain state object. Both follow the query.
|
|
49
50
|
*/
|
|
50
|
-
query: Readable<Pick<QueryState<T>, 'data' | 'status' | 'error'>> | Pick<QueryState<T>, 'data' | 'status' | 'error'>;
|
|
51
|
+
query: Readable<Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>> | Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>;
|
|
51
52
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
52
53
|
children: Snippet<[NonNullable<T>]>;
|
|
53
54
|
/** Initial idle/loading content. Render a status snippet, never a fake item or action. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD;;;;GAIG;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
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AO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACxB,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACxB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAA;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,4CAA4C;IAC5C,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,IAAI,CAAA;CACzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-query-svelte",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Svelte 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-svelte",
|
|
6
6
|
"type": "module",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
59
59
|
"@molecule/app-i18n": "1.2.2",
|
|
60
60
|
"@molecule/app-icons": "1.0.4",
|
|
61
|
-
"@molecule/app-query": "1.3.
|
|
61
|
+
"@molecule/app-query": "1.3.2",
|
|
62
62
|
"@molecule/app-query-memory": "1.1.0",
|
|
63
63
|
"@molecule/app-query-tanstack": "1.1.0",
|
|
64
64
|
"@molecule/app-svelte": "3.7.1",
|