Solid · Partial values

Listening to one path (select)

A listener added with select(path).on is called immediately, then only when the value at that path changes. In the example card arrives complete in the first chunk: its listener is called for that chunk and not again while answer grows.

Schema
z.object({
  card: z.object({ kind: z.string(), title: z.string() }),
  answer: z.string(),
  sources: z.array(z.string()),
})
Listeners
for (const part of ['card', 'answer', 'sources'])
  stream.select(part).on(() => calls.push(part))
Stream, chunk by chunk
Reply so far
{"card":{"kind":"answer","title":"Your seats"},
Listeners called for this chunk
['card']
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.