fix: undo previous change for only_touched? on form submit

This commit is contained in:
Zach Daniel 2023-09-18 19:06:27 -04:00
parent 6d9a7d59e9
commit e39558a7dd
6 changed files with 14 additions and 13 deletions

View file

@ -1566,13 +1566,6 @@ defmodule AshPhoenix.Form do
type: {:fun, 1},
doc:
"A function to apply to the source (changeset or query) just before submitting the action. Must return the modified changeset."
],
only_touched?: [
type: :boolean,
default: false,
doc: """
If set to true, only fields that have been marked as touched will be used.
"""
]
]
@ -1661,8 +1654,7 @@ defmodule AshPhoenix.Form do
end
changeset_params =
opts[:override_params] ||
params(form, only_touched?: Keyword.get(opts, :only_touched?, false))
opts[:override_params] || params(form)
prepare_source = form.prepare_source || (& &1)

View file

@ -1,4 +1,5 @@
defmodule AshPhoenix.Form.WrappedValue do
@moduledoc "A sentinal value used when editing a union that has non-map values"
use Ash.Resource,
data_layer: :embedded

View file

@ -1,4 +1,6 @@
defmodule AshPhoenix.Gen.Live do
@moduledoc false
def generate_from_cli(argv) do
if Mix.Project.umbrella?() do
Mix.raise(
@ -209,6 +211,7 @@ defmodule AshPhoenix.Gen.Live do
|> Ash.Resource.Info.public_attributes()
end
# sobelow_skip ["DOS.BinToAtom"]
defp action(resource, opts, type) do
action =
case opts[:"#{type}_action"] do
@ -361,18 +364,18 @@ defmodule AshPhoenix.Gen.Live do
end
end
defp web_path() do
defp web_path do
web_module().module_info[:compile][:source]
|> Path.relative_to(root_path())
|> Path.rootname()
end
defp root_path() do
defp root_path do
Mix.Project.get().module_info[:compile][:source]
|> Path.dirname()
end
defp web_module() do
defp web_module do
base = Mix.Phoenix.base()
cond do

View file

@ -152,7 +152,10 @@ defmodule AshPhoenix.MixProject do
defp aliases do
[
docs: ["docs", "ash.replace_doc_links"]
docs: ["docs", "ash.replace_doc_links"],
sobelow:
"sobelow --skip -i Config.Secrets --ignore-files lib/ash_phoenix/gen/live.ex"
]
end
end

View file

@ -1,4 +1,5 @@
defmodule AshPhoenix.Test.Foo do
@moduledoc false
use Ash.Resource, data_layer: :embedded
attributes do

View file

@ -1,4 +1,5 @@
defmodule AshPhoenix.Test.UnionValue do
@moduledoc false
use Ash.Type.NewType,
subtype_of: :union,
constraints: [