Skip to content

Version 2.0.0

Latest
Compare
Choose a tag to compare
@derrickreimer derrickreimer released this 21 Dec 18:16

Added

  • Add support new Inertia.js v2.0.0.
    • Add encrypt_history function to instruct the client-side to encrypt the history entry.
    • Add clear_history function to instruct the client-side to clear history.
    • Add inertia_optional function, to replace the now-deprecated inertia_lazy function.
    • Add inertia_merge function to instruct the client-side to merge the prop value with existing data.
    • Add inertia_defer function to instruct the client-side to fetch the prop value immediately after initial page load.
  • Add helpers for testing Inertia-based controller responses via the Inertia.Testing module.
  • Add a camelize_props global config option and a camelize_props function (to use on a per-request basis) to automatically convert prop keys from snake case to camel case.
  • Accept an ssr option on the render_inertia function.

Changed

  • Update Phoenix LiveView to v1.0.
  • The errors serializer (for Ecto.Changeset structs) has been adjusted to better align with the behavior in the Laravel adapter in cases when there are multiple validation errors for a single field.

Old behavior for errors serializer

Previously, the serializer would include each error under a separate key, with a [0] index suffix, like this:

{
  "name[0]": "is too long",
  "name[1]": "is not real"
}

While this retains maximal information about all the errors for a field, in practice it's difficult to target the right error records for display in the UI.

New behavior for errors serializer

Now, the serializer simply takes the first error message and returns it under the field name, without any added suffix:

{
  "name": "is too long"
}

Fixed

  • Allow for external redirects from PUT / PATCH / DELETE requests (#22)
  • Camelize prop names inside lists (e.g. assign_prop(:items, [%{item_name: "..."}])).

Deprecated

  • The inertia_lazy/1 function has been deprecated in favor of inertia_optional/1