How to do the LiveComponent preload example in Ash.Query?
In the docs for the
Phoenix.LiveComponent
(https://hexdocs.pm/phoenix_live_view/Phoenix.LiveComponent.html#module-preloading-and-update) there is a section there that shows how to use preload/1
to solve the N+1 problem:
How would I do the query in this section in Ash.Query?4 Replies
You'd do basically the same thing.
So instead of doing a
select
, just execute the query normally and then use Map.new
to produce the same result as the example above?Yeah, there isn't much of a point in doing
select: {u.id, u}
anyway
its a convenienceAlright. Thanks!