inertiajs / inertia-phoenix

The Phoenix adapter for Inertia.js.
https://hexdocs.pm/inertia
Other
185 stars 8 forks source link

Lazy data evaluation #7

Closed derrickreimer closed 5 months ago

derrickreimer commented 5 months ago

This is needed for #6, so that we can conditionally compute props only if they are needed.

We should accept functions for prop values in both modes for prop-setting: assign_prop and the props argument on render_inertia.

conn
|> assign_prop(:users, fn -> User.list() end)
|> render_inertia("Page", %{expensive thing: fn -> calculate() end})