@lotics/app-sdk 0.98.0 → 0.98.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/hooks.d.ts
CHANGED
|
@@ -343,8 +343,11 @@ export interface WorkflowResult<TData = unknown> {
|
|
|
343
343
|
* Either half of the round trip fills it: the SERVER, when the payload does
|
|
344
344
|
* not match what the alias declares, and the workflow's own
|
|
345
345
|
* `return({ field_errors })`. One key, so a screen wires the control once
|
|
346
|
-
* rather than branching on which half refused.
|
|
347
|
-
*
|
|
346
|
+
* rather than branching on which half refused. A step whose write the
|
|
347
|
+
* target table refuses (its `before_*` workflow, a unique tuple) keys its
|
|
348
|
+
* sentence by the FIELD key (`fld_…`) instead, since the table has never
|
|
349
|
+
* heard of the input. Absent when nothing named a field — and an older
|
|
350
|
+
* server names none.
|
|
348
351
|
*/
|
|
349
352
|
field_errors?: Record<string, string>;
|
|
350
353
|
}
|
|
@@ -265,7 +265,7 @@ client-side up front, and re-checked server-side.
|
|
|
265
265
|
- **The author is always the real signed-in member** — correct attribution, enforced server-side.
|
|
266
266
|
**Warning:** under "View as", comments still author as the real member (the admin), not the
|
|
267
267
|
view-as target — unlike `useViewer` and `is_current_member` scoping, which follow the target.
|
|
268
|
-
- **Edit and delete are author-only**, checked server-side against the viewer. `
|
|
268
|
+
- **Edit and delete are author-only**, checked server-side against the viewer. `EntryList`'s
|
|
269
269
|
`currentMemberId` prop drives the matching affordance client-side.
|
|
270
270
|
|
|
271
271
|
### Reading & writing
|
|
@@ -286,13 +286,13 @@ renders the panel. State: `{ comments, loading, error, available, createComment,
|
|
|
286
286
|
updateComment, deleteComment, refetch }`.
|
|
287
287
|
|
|
288
288
|
- `comments` — newest first on the wire (server order). Pass the array as-is to `@lotics/ui`'s
|
|
289
|
-
`
|
|
289
|
+
`EntryList`, which re-sorts oldest-first for display. Each `AppComment`: `{ id, record_id,
|
|
290
290
|
table_id, member_id, author, content, files, workspace_id, created_at, updated_at }`. Attachments
|
|
291
291
|
(`AppCommentFile`) carry `id` / `filename` / `mime_type` — a file's identity is its `id`, and
|
|
292
292
|
the server re-reads every attachment from storage by that id, so nothing else you hold about a
|
|
293
293
|
file can affect what is stored. The `url` / `thumbnail_url` / `preview_url` fields exist on the type
|
|
294
294
|
but the server does not populate them today — render attachments by name and type (what
|
|
295
|
-
`
|
|
295
|
+
`EntryList`'s default file row does), never by counting on a fetchable URL.
|
|
296
296
|
- `createComment({ content, file_ids? })` — posts as the viewing member. `file_ids` come from
|
|
297
297
|
`useFileUpload` / `useAttachments` (see [files](./files.md)). A comment must have content or at
|
|
298
298
|
least one file (empty input is a client no-op; the server enforces the same rule). Content max
|
|
@@ -308,7 +308,7 @@ updateComment, deleteComment, refetch }`.
|
|
|
308
308
|
app by someone the record references nowhere. So a thread that crosses a role boundary is legible without the app declaring member
|
|
309
309
|
access it does not otherwise need, and a per-viewer app never widens its reach for a display
|
|
310
310
|
string. `name` is `null` when the id no longer resolves in the org (a removed member) — render a
|
|
311
|
-
fallback (`
|
|
311
|
+
fallback (`EntryList` has an `unknownMember` label for exactly this). The one comment with no
|
|
312
312
|
`author` is the optimistic row `createComment` renders locally: the SDK knows the viewer's id and
|
|
313
313
|
not their name, and it will not invent one. The server's row replaces it when the refetch lands.
|
|
314
314
|
- **Freshness:** SWR-cached, revalidates on focus/reconnect, so another viewer's comment appears on
|
|
@@ -336,7 +336,7 @@ directly (full props: `node_modules/@lotics/ui/AGENTS.md` and its `docs/`):
|
|
|
336
336
|
| A select value (stored or picker option) | `Status` | A `useFieldOptions` option, or `byKey(readSelect(cell)[0]?.key)`; accepts a single option, an array (multi → one badge each), or null (renders nothing). Missing/unknown color → neutral. |
|
|
337
337
|
| A person, inline | `MemberChip` | `name` / `image` from a roster or a cell — both carry it; no image → initials |
|
|
338
338
|
| A member picker | `MemberSelect` | `members={useMembers().members}` — renders each option as a `MemberChip`; `MEMBER_UNASSIGNED` marks its optional "unassigned" option |
|
|
339
|
-
| A comment thread | `
|
|
339
|
+
| A comment thread | `EntryList` + `CommentComposer` | `useComments` state; `resolveMember` reads each comment's own `author` (`{ name, image }`) — no roster needed |
|
|
340
340
|
|
|
341
341
|
The SDK never imports `@lotics/ui` — the app owns the (thin) data→UI adapter in each row above.
|
|
342
342
|
|