Skip to content

Commit

Permalink
Version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickreimer committed Dec 21, 2024
1 parent 20cc7d9 commit 9257896
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 39 deletions.
55 changes: 19 additions & 36 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
# Changelog

## Unreleased
## 2.0.0

- Update Phoenix LiveView to v1.0.

## 1.0.0-beta.3

### Bug Fixes

- Camelize prop names inside lists (e.g. `assign_prop(:items, [%{item_name: "..."}])`).

## 1.0.0-beta.2

### Features

- Accept a `ssr` option on the `render_inertia` function.
### Added

## 1.0.0-beta.1
- 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.

### Breaking Changes
### Changed

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**.
- 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**
**Old behavior for errors serializer**

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

Expand All @@ -35,7 +32,7 @@ Previously, the serializer would include each error under a separate key, with a

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**
**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:

Expand All @@ -45,26 +42,12 @@ Now, the serializer simply takes the _first error message_ and returns it under
}
```

### Bug Fixes
### Fixed

- Allow for external redirects from `PUT` / `PATCH` / `DELETE` requests ([#22](https://github.com/inertiajs/inertia-phoenix/pull/22))
- Camelize prop names inside lists (e.g. `assign_prop(:items, [%{item_name: "..."}])`).

### Features

Support new Inertia v2 mechanics 🎉. There are no breaking changes required to support v2, only new features:

- 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.

This version also includes some new features:

- Helpers for testing Inertia-based controller responses via the `Inertia.Testing` module.
- Added 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.

### Deprecations
### Deprecated

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

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Inertia.js Phoenix Adapter [![Hex Package](https://img.shields.io/hexpm/v/inertia)](https://hex.pm/packages/inertia) [![Hex Docs](https://img.shields.io/badge/docs-green)](https://hexdocs.pm/inertia/readme.html)

The Elixir/Phoenix adapter for [Inertia.js](https://inertiajs.com/).
The official Elixir/Phoenix adapter for [Inertia.js](https://inertiajs.com/).

## Table of Contents

Expand All @@ -25,7 +25,7 @@ The package can be installed by adding `inertia` to your list of dependencies in
```elixir
def deps do
[
{:inertia, "~> 1.0.0-beta.3"}
{:inertia, "~> 2.0.0"}
]
end
```
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Inertia.MixProject do
use Mix.Project

@version "1.0.0-beta.3"
@version "2.0.0"

def project do
[
Expand Down

0 comments on commit 9257896

Please sign in to comment.