Cinder 0.18 is out. It's a big one: a handful of new options, and a long list of fixes for things that quietly went wrong before. This should be the last point release before 1.0, other than bug fixes.
Upgrading
0.18 needs Phoenix LiveView 1.1 and Ash 3.24.5, and now ships a colocated JS hook that your app.js has to register. The upgrade task does that for you:
mix cinder.upgrade 0.17.0 0.18.0
One behaviour change to know about. A filter that fails to build now shows the collection's error state, instead of quietly showing unfiltered results. If a collection shows its error after upgrading, your logs will say which filter failed.
Render the first page on the server
initial_load={:sync} loads the first page of data before the page renders, so it's in the server-rendered HTML: no loading state, and something for crawlers to read.
<Cinder.collection resource={MyApp.Catalog.Item} initial_load={:sync}>
<:col :let={item} field="name" sort>{item.name}</:col>
</Cinder.collection>
Count in the background, or not at all
Counting every matching record can be the slowest part of loading a big table. pagination now takes a count option: :async counts in the background while the page shows, and false skips the count entirely.
<Cinder.collection
resource={MyApp.Logs.Event}
pagination={[mode: :keyset, count: :async]}
>
Also new
- Columns load what their defined fields need (relationships, calculations and aggregates), so you no longer need
query_opts={[load: ...]}for them. If you need extra data, eg. to display in a grid/list, you'll still need to add the loads manually. sort={[then: ["inserted_at"]]}adds tiebreaker fields after the user's own sorts.use Cinder.UrlSyncis all a LiveView needs for URL sync now. If you have ahandle_paramsevent handler that just callsCinder.UrlSync.handle_params, you can delete it!on_query_changepayloads include the totalcount.refresh_table/3takessilent: true, and the newremove_item/3drops rows without re-querying.- Collections emit
[:cinder, :query]and[:cinder, :count]telemetry spans. See the telemetry guide for more information.
There are around twenty bug fixes too, from keyset pagination's "Next page" to autocomplete filters reloading on every keystroke. The full changelog has all of them.
Thanks to everyone who contributed to this release!