Skip to content

Commit

Permalink
fix: handle nil value for old_values (#1191)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasJ authored May 22, 2024
1 parent ab3786e commit 3e7f691
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ash/embeddable_type.ex
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ defmodule Ash.EmbeddableType do
Ash.Resource.Info.primary_action!(__MODULE__, :destroy).name

old_values
|> List.wrap()
|> Enum.with_index()
|> then(fn list ->
if Enum.empty?(pkey_fields) do
Expand Down Expand Up @@ -834,7 +835,9 @@ defmodule Ash.EmbeddableType do
{:cont, {:ok, [new | new_uncasted_values]}}
else
value_updating_from =
Enum.find(old_values, fn old_value ->
old_values
|> List.wrap()
|> Enum.find(fn old_value ->
Map.take(old_value, pkey_fields) ==
pkey
end)
Expand Down

0 comments on commit 3e7f691

Please sign in to comment.