Skip to content

v3.0.0

Latest

Choose a tag to compare

@georgeguimaraes georgeguimaraes released this 28 Apr 13:47
91522af

Corrects the phoenix-thinking guidance on mount/3 vs handle_params/3.

The previous "Iron Law" said queries belong in handle_params/3 instead of mount/3 to avoid duplicate queries on initial load. That rationale is wrong: handle_params/3 also runs twice on initial load (dead render + connected render), so moving queries there does not dedupe anything.

What changed:

  • Default is now to load data in mount/3. handle_params/3 is for data that changes on live navigation (push_patch / <.link patch={...}>), since mount does not re-run on patches
  • For the actual initial double-load problem, the skill now lists the real tools with accurate descriptions: connected?/1 to gate work to the connected render, assign_async/3 to defer the load, and assign_new/3 to reuse conn.assigns set by upstream Plugs (it does not dedupe arbitrary mount work)
  • Added a small connected?/1 code example
  • Fixed the Red Flags entry that flagged any DB query in mount

Bumps:

  • elixir plugin: 1.13.0 to 2.0.0
  • marketplace: 2.0.0 to 3.0.0

Thanks to @khs-kks for digging this up in #9.