@lotics/app-sdk 0.88.0 → 0.88.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/dist/src/comments.d.ts +6 -3
- package/dist/src/comments.js +2 -2
- package/docs/members_and_options.md +3 -1
- package/docs/queries.md +4 -1
- package/package.json +1 -1
package/dist/src/comments.d.ts
CHANGED
|
@@ -87,8 +87,11 @@ export interface CommentCountsState {
|
|
|
87
87
|
refetch: () => void;
|
|
88
88
|
}
|
|
89
89
|
export interface UseCommentCountsArgs {
|
|
90
|
-
/** The table whose per-record comment counts to read.
|
|
91
|
-
|
|
90
|
+
/** The table whose per-record comment counts to read. Read it off a row
|
|
91
|
+
* (`__source_table_id`) rather than pasting a `tbl_` id — a copy of the app
|
|
92
|
+
* runs over other tables. `undefined` (no row on screen yet) sends no
|
|
93
|
+
* request and answers `{}`. */
|
|
94
|
+
table_id: string | undefined;
|
|
92
95
|
}
|
|
93
96
|
/**
|
|
94
97
|
* Per-record comment counts for a whole table, as `{ record_id: count }` — for
|
|
@@ -96,7 +99,7 @@ export interface UseCommentCountsArgs {
|
|
|
96
99
|
* server-side `GROUP BY`. App-authority like {@link useComments}.
|
|
97
100
|
*
|
|
98
101
|
* ```tsx
|
|
99
|
-
* const { counts } = useCommentCounts({ table_id });
|
|
102
|
+
* const { counts } = useCommentCounts({ table_id: rows[0]?.__source_table_id });
|
|
100
103
|
* // counts[row.__source_record_id] ?? 0
|
|
101
104
|
* ```
|
|
102
105
|
*/
|
package/dist/src/comments.js
CHANGED
|
@@ -170,7 +170,7 @@ export function useComments(args) {
|
|
|
170
170
|
* server-side `GROUP BY`. App-authority like {@link useComments}.
|
|
171
171
|
*
|
|
172
172
|
* ```tsx
|
|
173
|
-
* const { counts } = useCommentCounts({ table_id });
|
|
173
|
+
* const { counts } = useCommentCounts({ table_id: rows[0]?.__source_table_id });
|
|
174
174
|
* // counts[row.__source_record_id] ?? 0
|
|
175
175
|
* ```
|
|
176
176
|
*/
|
|
@@ -178,7 +178,7 @@ export function useCommentCounts(args) {
|
|
|
178
178
|
const { table_id } = args;
|
|
179
179
|
const { memberId, commentsEnabled, resolved } = useAppContext();
|
|
180
180
|
const available = memberId != null && commentsEnabled;
|
|
181
|
-
const swr = useSWR(available ? ["app-comment-counts", table_id] : null, () => rpc("comments.counts", { table_id }), { shouldRetryOnError: false });
|
|
181
|
+
const swr = useSWR(available && table_id !== undefined ? ["app-comment-counts", table_id] : null, () => rpc("comments.counts", { table_id }), { shouldRetryOnError: false });
|
|
182
182
|
const refetch = useCallback(() => {
|
|
183
183
|
void swr.mutate();
|
|
184
184
|
}, [swr]);
|
|
@@ -309,7 +309,9 @@ updateComment, deleteComment, refetch }`.
|
|
|
309
309
|
`useCommentCounts({ table_id })` → `{ counts, loading, error, available, refetch }` where `counts`
|
|
310
310
|
is `{ record_id: count }` for the whole table — row badges without shipping any comment content
|
|
311
311
|
(one server-side aggregate). Same gate and authority as `useComments`. `table_id` is the source
|
|
312
|
-
table's id
|
|
312
|
+
table's id: read it off a row of the query that renders the badges (`rows[0]?.__source_table_id`)
|
|
313
|
+
rather than pasting a `tbl_` id, which a copy of the app cannot carry. Pass `undefined` while no
|
|
314
|
+
row is on screen — no request is sent and `counts` is `{}`.
|
|
313
315
|
|
|
314
316
|
## Pairing with `@lotics/ui`
|
|
315
317
|
|
package/docs/queries.md
CHANGED
|
@@ -538,7 +538,10 @@ Negation-shaped inner operators (`has_none_of`, `not_equals`, `is_none_of`,
|
|
|
538
538
|
"any record matches the negation".
|
|
539
539
|
|
|
540
540
|
Traversals are **source-layer only** (rejected on derived columns — push them into
|
|
541
|
-
`from_table.filter`).
|
|
541
|
+
`from_table.filter`). Each hop reaches the linked rows by primary key from the ids in the link
|
|
542
|
+
cell. Under an OR beside column conditions a traversal runs once per row and takes the column
|
|
543
|
+
conditions off their indexes with it; give it a `union` arm of its own when the other arms must
|
|
544
|
+
stay index-served. Two access classes:
|
|
542
545
|
|
|
543
546
|
- **Self-scoped** — inner operator `is_current_member` / `is_not_current_member`: tests only
|
|
544
547
|
the viewer's own membership on the linked row, leaks nothing, and is exempt from the linked
|