@lotics/app-sdk 0.82.0 → 0.82.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/docs/ai.md +19 -0
- package/package.json +1 -1
package/docs/ai.md
CHANGED
|
@@ -322,6 +322,25 @@ Publish the **rendered** view, not the whole table. A screen that shows page 2 o
|
|
|
322
322
|
|
|
323
323
|
Declarative and lifecycle-bound: mounting or changing `context` pushes it; unmounting, renaming the `slot`, or passing `null` clears it. Independent components hold **different slots** at once (a list screen + an open drawer), and the newest value per slot wins. Re-posting is change-gated — passing a fresh inline object each render does **not** spam the host; only a real value change re-publishes.
|
|
324
324
|
|
|
325
|
+
### A slot that never publishes looks exactly like a slot with nothing to say
|
|
326
|
+
|
|
327
|
+
The failure mode worth knowing before you wire one: this hook has **no visible output**. A
|
|
328
|
+
`useAiContext` behind a guard that never opens publishes `null` forever while the screen it
|
|
329
|
+
describes renders perfectly, and nothing anywhere reports it. Silence is the same shape as
|
|
330
|
+
"there is nothing to report", so neither the app nor a review catches it.
|
|
331
|
+
|
|
332
|
+
The usual cause is a guard on the query state. `useQuery`'s `error` is `string | null` — it is
|
|
333
|
+
**never `undefined`** — so `error !== undefined` is always true and holds the guard shut on every
|
|
334
|
+
render. Write `if (loading || error) return;`, which is correct whichever of the two the field
|
|
335
|
+
turns out to be, and reads as the question you meant.
|
|
336
|
+
|
|
337
|
+
**Verify by observing what is published, never by reading the code.** Run the app under
|
|
338
|
+
`lotics app dev` and listen for the host notification on the wrapper page — the payload is the
|
|
339
|
+
context as the chat agent will receive it. Check three things, because each fails differently:
|
|
340
|
+
the slot carries REAL values matching what is on screen (not placeholders), it clears to `null`
|
|
341
|
+
when the surface closes or the tab changes, and it does not publish while the first read is still
|
|
342
|
+
in flight — a count of zero taken from a pending query is an answer nothing measured.
|
|
343
|
+
|
|
325
344
|
### The caps (host-enforced — exceeding them truncates or drops, never errors)
|
|
326
345
|
|
|
327
346
|
| Field | Cap |
|