mirror of
https://github.com/ash-project/ash_phoenix.git
synced 2024-09-20 07:12:49 +12:00
fix: properly restrict errors to the current form
This commit is contained in:
parent
6f011a55fe
commit
f400a9fc1f
1 changed files with 6 additions and 3 deletions
|
@ -35,7 +35,7 @@ defmodule AshPhoenix.FormData.Helpers do
|
|||
|
||||
defp match_path_filter?(path, path_filter, form_keys \\ []) do
|
||||
path == path_filter ||
|
||||
(!Enum.empty?(form_keys) &&
|
||||
(!Enum.empty?(form_keys) && Enum.count(path) > Enum.count(path_filter) &&
|
||||
!form_would_capture?(form_keys, path, path_filter))
|
||||
end
|
||||
|
||||
|
@ -63,8 +63,11 @@ defmodule AshPhoenix.FormData.Helpers do
|
|||
errors
|
||||
|> Enum.filter(fn error ->
|
||||
if Map.has_key?(error, :path) && path_filter do
|
||||
match? =
|
||||
match_path_filter?(error.path, path_filter, form_keys) ||
|
||||
Enum.any?(additional_path_filters, &match_path_filter?(error.path, &1))
|
||||
|
||||
match?
|
||||
else
|
||||
false
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue