fix: don't raise on unknown inputs for filters

This commit is contained in:
Zach Daniel 2023-06-26 11:38:46 -04:00
parent b7a9ea6502
commit 638ec3f93c
2 changed files with 7 additions and 4 deletions

View file

@ -1212,8 +1212,8 @@ defmodule AshPhoenix.FilterForm do
to_form(form, phoenix_form, :components, [])
end
def input_value(_, _, field) do
raise "Invalid filter form field #{field}. Only :id, :negated, and :operator are supported"
def input_value(_, _, _field) do
nil
end
@impl true

View file

@ -111,8 +111,11 @@ defmodule AshPhoenix.FilterForm.Predicate do
def input_value(%{negated?: negated?}, _, :negated), do: negated?
def input_value(%{path: path}, _, :path), do: Enum.join(path, ".")
def input_value(_, _, field) do
raise "Invalid filter form field #{field}. Only :id, :negated, :operator, :field, :path, :value are supported"
def input_value(_, _, _field) do
nil
# We can't raise here
# raise "Invalid filter form field #{field}. Only :id, :negated, :operator, :field, :path, :value are supported"
end
@impl true