"Comparing values with `nil` will always return `false`" warning after updating ash 3.5.34 to 3.5.35

So I updated the deps today and I get a lot of these warnings. warning: Comparing values with nil will always return false. Use is_nil/1 instead. In: nil != {:_ref, [], :current_stop_id} (ash 3.5.35) lib/ash/changeset/changeset.ex:973: anonymous fn/2 in Ash.Changeset.atomic_default_condition/3 (elixir 1.18.4) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3 (ash 3.5.35) lib/ash/changeset/changeset.ex:968: Ash.Changeset.atomic_default_condition/3 (ash 3.5.35) lib/ash/changeset/changeset.ex:935: anonymous fn/3 in Ash.Changeset.atomic_lazy_update_defaults/1 (elixir 1.18.4) lib/enum.ex:4968: Enumerable.List.reduce/3 (elixir 1.18.4) lib/enum.ex:2600: Enum.reduce_while/3 (ash 3.5.35) lib/ash/changeset/changeset.ex:840: Ash.Changeset.fully_atomic_changeset/4 (ash 3.5.35) lib/ash/actions/update/update.ex:88: Ash.Actions.Update.run/4 (ash 3.5.35) lib/ash.ex:3638: Ash.update/3 (zelo 0.1.0) lib/zelo/planner/resources/change/clear_current_stop .ex:49: Zelo.Planner.Resources.Change.ClearCurrentStop.handle_parcel_current_stop/4 (ash 3.5.35) lib/ash/changeset/changeset.ex:4499: anonymous fn/2 in Ash.Changeset.run_before_actions/1 (elixir 1.18.4) lib/enum.ex:4968: Enumerable.List.reduce/3 (elixir 1.18.4) lib/enum.ex:2600: Enum.reduce_while/3 (ash 3.5.35) lib/ash/changeset/changeset.ex:4474: Ash.Changeset.run_before_actions/1 (ash 3.5.35) lib/ash/changeset/changeset.ex:4613: Ash.Changeset.run_around_actions/2 (ash 3.5.35) lib/ash/changeset/changeset.ex:4166: anonymous fn/3 in Ash.Changeset.with_hooks/3 (ash 3.5.35) lib/ash/data_layer/data_layer.ex:421: Ash.DataLayer.transaction/4 (ash 3.5.35) lib/ash/changeset/changeset.ex:4164: anonymous fn/3 in Ash.Changeset.with_hooks/3 ```
4 Replies
jeroen11dijk
jeroen11dijkOP2mo ago
Where my lib/zelo/planner/resources/change/clear_current_stop .ex:49: Order.set_current_stop(order, nil, actor: actor, tenant: tenant)
update :set_current_stop do
argument :current_stop_id, :uuid
change atomic_update(:current_stop_id, arg(:current_stop_id))
end
update :set_current_stop do
argument :current_stop_id, :uuid
change atomic_update(:current_stop_id, arg(:current_stop_id))
end
And I have some more of these actions where I set an attribute to nil using an argument. Should I change this to a specific nil action?
barnabasj
barnabasj2mo ago
If you don't depend on the previous value you can use set_attribute instead of atomic_update
sevenseacat
sevenseacat2mo ago
its been fixed already and will be released in the next version of Ash

Did you find this page helpful?