Lavash.LiveView.Runtime (Lavash v0.3.0-rc.2)

Copy Markdown View Source

Runtime implementation for Lavash LiveViews.

Handles:

  • State hydration from URL params
  • Ephemeral state initialization
  • Dependency graph computation
  • Action execution
  • Assign projection

Summary

Functions

handle_event(module, event, params, socket)

handle_info(module, msg, socket)

handle_params(module, params, uri, socket)

mount(module, params, session, socket)

update_combination_subscriptions(socket, module, old_state)

Update combination-based subscriptions based on current filter values.

For reads with invalidate: :pubsub, subscribes to a single combination topic based on which filters are currently active (non-nil). Uses the resource's notify_on configuration to determine which attributes to track. Unsubscribes from old topic when filter values change.

wrap_render(module, assigns, inner_content)

Wraps the user's render output with optimistic state tracking if needed.

If the module has any optimistic fields (state or derives with optimistic: true), wraps the rendered content in a div with the LavashOptimistic hook and state data.