Deterministic rendering & state restoration without additional caching.
- Use session and URL params as the starting point
- Session includes user ID, roles, or any state that persists across LiveViews.
- URL params /
handle_params/3
: includes context, like which record is being edited. Only minimum data to restore state should be kept there. I.e. If we have multiple forms on page, and we need to keep track on which of them are open.
- Fetch all persistent data from a deterministic source (
mount
,handle_params
) - Use form params to reconstruct unsaved input
- The
phx-change
/validate
event sends the client’s current form state.
- The