@lotics/app-sdk 0.87.5 → 0.87.7
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/dist/src/hooks.js +9 -3
- package/dist/src/row.d.ts +3 -1
- package/dist/src/row.js +3 -1
- package/docs/data_fetching.md +5 -2
- package/docs/workflows.md +5 -0
- package/package.json +1 -1
package/dist/src/hooks.js
CHANGED
|
@@ -71,6 +71,14 @@ function swrConfig(revalidateOnFocus) {
|
|
|
71
71
|
revalidateOnFocus,
|
|
72
72
|
revalidateOnReconnect: revalidateOnFocus,
|
|
73
73
|
shouldRetryOnError: false,
|
|
74
|
+
// A query's KEY carries its params, filter and sort, so anything derived
|
|
75
|
+
// from the rows on screen re-keys the moment they change. Without this SWR
|
|
76
|
+
// answers a new key with `undefined`, `rows` falls to `[]`, and every list
|
|
77
|
+
// renders empty for a frame — unmounting each row's images, which remount
|
|
78
|
+
// blank. That is the behaviour the `loading` contract above already
|
|
79
|
+
// promises against, and what the product app sets globally for the same
|
|
80
|
+
// reason.
|
|
81
|
+
keepPreviousData: true,
|
|
74
82
|
};
|
|
75
83
|
}
|
|
76
84
|
/**
|
|
@@ -289,9 +297,7 @@ export function usePaginatedQuery(alias, params, opts) {
|
|
|
289
297
|
offset: page * pageSize,
|
|
290
298
|
sort,
|
|
291
299
|
filter,
|
|
292
|
-
}),
|
|
293
|
-
// Keep the previous page's rows on screen while the next page loads.
|
|
294
|
-
{ keepPreviousData: true, ...swrConfig(revalidateOnFocus) });
|
|
300
|
+
}), swrConfig(revalidateOnFocus));
|
|
295
301
|
// Not counted when the caller supplies the total, when the hook is disabled,
|
|
296
302
|
// or under a fixture — see `useCountRead` for why the key drops page and sort.
|
|
297
303
|
const countSwr = useCountRead(alias, params, filter, !mockRows && enabled && !callerOwnsTotal, revalidateOnFocus);
|
package/dist/src/row.d.ts
CHANGED
|
@@ -86,7 +86,9 @@ export interface AppFile {
|
|
|
86
86
|
/**
|
|
87
87
|
* files field → the attached files with their presigned `url` (empty if none).
|
|
88
88
|
* Skips entries the server didn't presign (no `url`) so a consumer never renders
|
|
89
|
-
* an unservable file.
|
|
89
|
+
* an unservable file. Pass one to `toDisplayFile` from `@lotics/ui/file_thumbnail`
|
|
90
|
+
* for FileThumbnail/Gallery — the kit owns that conversion, so don't re-declare
|
|
91
|
+
* it per app.
|
|
90
92
|
*/
|
|
91
93
|
export declare function readFiles(v: unknown): AppFile[];
|
|
92
94
|
/**
|
package/dist/src/row.js
CHANGED
|
@@ -113,7 +113,9 @@ export function readLinks(v) {
|
|
|
113
113
|
/**
|
|
114
114
|
* files field → the attached files with their presigned `url` (empty if none).
|
|
115
115
|
* Skips entries the server didn't presign (no `url`) so a consumer never renders
|
|
116
|
-
* an unservable file.
|
|
116
|
+
* an unservable file. Pass one to `toDisplayFile` from `@lotics/ui/file_thumbnail`
|
|
117
|
+
* for FileThumbnail/Gallery — the kit owns that conversion, so don't re-declare
|
|
118
|
+
* it per app.
|
|
117
119
|
*/
|
|
118
120
|
export function readFiles(v) {
|
|
119
121
|
if (!Array.isArray(v))
|
package/docs/data_fetching.md
CHANGED
|
@@ -136,8 +136,11 @@ server validates system conditions by `type` and never reads `field_key` on them
|
|
|
136
136
|
are no rows yet. It stays `false` during background revalidation of a key that already has rows,
|
|
137
137
|
so consumers never blank loaded data to a spinner on refetch. A key *change* (new params, sort,
|
|
138
138
|
filter, or page) is a fresh load: `loading` goes `true` again unless that key is already cached —
|
|
139
|
-
|
|
140
|
-
gate on `loading && rows.length === 0`, never `loading`
|
|
139
|
+
but the previous key's rows STAY on screen while it resolves, for every query, so `rows` never
|
|
140
|
+
empties mid-flight. That is why skeletons gate on `loading && rows.length === 0`, never `loading`
|
|
141
|
+
alone: a filter derived from what is on screen re-keys on every keystroke, and gating on
|
|
142
|
+
`loading` swaps the list for a spinner each time — which unmounts everything the rows contained,
|
|
143
|
+
images included. **`isValidating`** is `true`
|
|
141
144
|
whenever any request is in flight — use it for a subtle refresh indicator.
|
|
142
145
|
- **`error`** is a `string | null`. A failed query surfaces immediately — there is **no automatic
|
|
143
146
|
retry** (no retry loop that masks the error). The last successful rows for the same key stay
|
package/docs/workflows.md
CHANGED
|
@@ -688,6 +688,11 @@ to let the call site supply the type. Keep the loop for FINDING values and put t
|
|
|
688
688
|
a filtered `query_records` that scans for the row you just made: the filtered form is both an
|
|
689
689
|
extra scan and wrong under concurrency, since a row created between your write and your read
|
|
690
690
|
matches the same filter.
|
|
691
|
+
- **A write that makes rows live can be refused by the plan's record allowance.** `create_records`,
|
|
692
|
+
a draft submit and a restore all count against the organization's live rows; the one that would
|
|
693
|
+
exceed the allowance fails the run with a sentence for a person ("Your plan's record allowance is
|
|
694
|
+
full…", in the reader's language) and none of that call's rows land. Archiving records frees
|
|
695
|
+
room. Updates never trip it.
|
|
691
696
|
|
|
692
697
|
### Keep expensive steps off the path the caller waits on
|
|
693
698
|
|