DialectoInContext.LiveView (dialecto_in_context v0.1.0)

Copy Markdown View Source

Live-site marking for LiveViews. A LiveView runs in its own process, which the plug's flag never reaches, so add the hook to the app's live_sessions:

live_session :default, on_mount: [DialectoInContext.LiveView] do
  live "/", HomeLive
end

Only the render of a mount or a navigation (handle_params) is marked. The session holds the launch token's expiry (the plug put it there after verifying the token), and each mount and each handle_params checks that it has not passed. Before an event, a message or an async result is handled the flag is turned off, and again after every render, so text a callback writes to the database, a mail, a PubSub broadcast or a job never carries markers, and neither does a LiveComponent's event, which the view's own hooks never see. Text re-rendered after an interaction loses its marker until the next navigation.

The first, HTTP render runs in the request's process, where the plug already decided. The hook needs no LiveView dependency of its own and does nothing outside :live.