Skip to content

v0.9.0

Choose a tag to compare

@github-actions github-actions released this 09 Oct 14:51
· 111 commits to main since this release

Elements no longer mount with half their props while a spec streams.

When <json-render> has a catalog and loading is true, an element whose props do not yet pass its component's schema is held back: it shows the new fallback from its registry entry, or nothing, and the component mounts once the props arrive. Until now a Card whose title had not streamed in yet mounted with title: undefined, and apps filtered out elements without props by hand to avoid that.

What changes for your app

  • Behaviour change if you bind [catalog] while streaming (the agent skill's streaming example does): elements whose required props have not arrived appear only once complete, or as their fallback, instead of half-filled. Without [catalog], nothing changes.
  • New: fallback on a registry entry, also through defineRegistry(catalog, { components: { Card: { component: CardComponent, fallback: CardSkeleton } } }). The fallback gets the same render context as the component, so it can read the props that have arrived and place <jr-children /> for the children that have.
  • Props are checked as the spec writes them: an expression such as { "$state": "/title" } counts as arrived, whatever it resolves to. A type the catalog has no props schema for is never held.
  • A component that has mounted never goes back to its fallback, even if a later patch removes a prop. When loading turns false every element mounts, valid or not; reporting what is wrong with the finished spec stays validate's job.

Also in this release

  • README: a "Switching language" section. $t keys re-translate in place when directives is derived from a locale signal, with nothing remounted (now covered by a test); text the model wrote needs a new generation.

Upgrading

npm i ngx-json-render@0.9.0 ngx-json-render-material@0.3.12 — install the pair together. If you bind [catalog] while streaming, watch one generation: anything that relied on rendering incomplete props now waits for them, so add a fallback where you want a placeholder in the meantime.

Full Changelog: v0.8.2...v0.9.0