# Upgrading to v0.15

## Bump Your Deps

Update Backpex to the latest version:

```elixir
defp deps do
  [
    {:backpex, "~> 0.15.0"}
  ]
end
```

## Index edit input defaults have changed

We have updated the default classes for index edit inputs. Mainly, we have removed the hardcoded width. To increase the width of index edit inputs, use the `index_column_class` option on your field:

```elixir
def fields do
  [
    username: %{
      module: Backpex.Fields.Text,
      label: "Username",
      index_editable: true,
      index_column_class: "min-w-[10rem]"
    },
    ...
  ]
end
```

## Phoenix 1.8 layout changes

In Phoenix v1.7 and earlier versions, the layout was usually configured at LiveView level. 

```elixir
use Phoenix.LiveView, layout: {MyAppWeb.Layouts, :app}
```

Backpex configured the provided layout in the same way.

From Phoenix v1.8, the layout is explicitly rendered in templates by calling the `<Layouts.app />` component.

See https://hexdocs.pm/phoenix_live_view/1.1.8/live-layouts.html and https://www.phoenixframework.org/blog/phoenix-1-8-released

Backpex adapts to this change, interpreting your configured layout as a component called in every Backpex LiveView.

Ensure that your layout can be used as a component. At the very least, check that you've replaced `{@inner_block}` with `{render_slot (@inner_block)}` in your template. You may also want to add declarative assigns and a bodyless function definition to your layout, or extract the entire markup to `MyAppWeb.Layouts`.

Note that it is now also possible to configure the layout as a function:

```elixir
use Backpex.LiveResource,
  layout: &MyAppWeb.admin/1
```

## Resource and adapter functions have been updated

We've updated some functions in `Backpex.Resource` and the adapter modules (`Backpex.Adapters.Ecto` and `Backpex.Adapters.Ash`) to include the fields as an additional parameter.

The following functions are affected:

`Backpex.Resource`:
- `list/3` -> `Backpex.Resource.list/4`
- `count/3` -> `Backpex.Resource.count/4`
- `get/3` -> `Backpex.Resource.get/4`
- `get!/3` -> `Backpex.Resource.get!/4`

`Backpex.Adapter` (including `Backpex.Adapters.Ecto` and `Backpex.Adapters.Ash`):
- `list/3` -> `c:Backpex.Adapter.list/4`
- `count/3` -> `c:Backpex.Adapter.count/4`
- `get/3` -> `c:Backpex.Adapter.get/4`

For example:

```elixir
# before
Resource.get(primary_value, socket.assigns, live_resource)
# after
Resource.get(primary_value, fields, socket.assigns, live_resource)
```

## `:only`/`:except` field option changes

You no longer need to pass `:resource_action` in addition to `:index` to the fields `:only`/`:except` option.
Before, it was needed to make fields visible behind the backdrop of the resource action modal.
