Skip to content

Commit

Permalink
Merge pull request #122 from naymspace/feature/fix-nil-select
Browse files Browse the repository at this point in the history
Fix nil value was not properly displayed in select field
  • Loading branch information
Flo0807 authored Feb 21, 2024
2 parents bbbb5f1 + c055359 commit 4ac1a6e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/backpex/fields/select.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,9 @@ defmodule Backpex.Fields.Select do
@impl Backpex.Field
def render_value(assigns) do
options = Map.get(assigns.field_options, :options)
label = get_label(assigns.value, options)

label =
assigns.value
|> Atom.to_string()
|> get_label(options)

assigns =
assigns
|> assign(:label, label)
assigns = assign(assigns, :label, label)

~H"""
<p class={@live_action in [:index, :resource_action] && "truncate"}>
Expand Down

0 comments on commit 4ac1a6e

Please sign in to comment.