improvement: Remove domain opt from AshPhoenix.LiveView (#167)

This commit is contained in:
Jinkyou Son 2024-04-24 19:24:14 +09:00 committed by GitHub
parent b8c2d4034e
commit 94e17780ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,11 +38,6 @@ defmodule AshPhoenix.LiveView do
type: :any,
doc: "Results to use instead of running the query immediately."
],
domain: [
type: :atom,
doc:
"For paginated views, in order to use `change_page/3`, you must set the Domain to use for pagination"
],
refetch_interval: [
type: :non_neg_integer,
doc: "An interval (in ms) to periodically refetch the query"
@ -219,11 +214,7 @@ defmodule AshPhoenix.LiveView do
data -> data
end
unless config.opts[:domain] do
raise "Must set domain to use change_page/3"
end
new_result = config.opts[:domain].page!(current_page, target)
new_result = Ash.page!(current_page, target)
{_query, rerun_opts} = new_result.rerun
new_page_opts = Keyword.merge(config.opts[:page] || [], rerun_opts[:page])
new_opts = Keyword.put(config.opts, :page, new_page_opts)