Filament.LiveView behaviour (filament v0.2.1)

Copy Markdown

Phoenix LiveView adapter for Filament components.

This module provides the integration point between Filament's fiber-based reconciliation and Phoenix LiveView's rendering engine.

Usage

In your LiveView module:

defmodule MyApp.MyLiveView do
  use Filament.LiveView

  def root_component(), do: MyApp.MyComponent
end

Options

static_subscribe: boolean (default true) — when true, observable subscriptions are made during the static (HTTP) render pass, not just after the WebSocket connects. This produces fully-rendered initial HTML with real data, which is beneficial for SEO and perceived performance.

When false, all use_observable calls return their :disconnected value during the static render; real data appears after the WebSocket connects.

Note: Phoenix LiveView uses separate OS processes for the static render and the connected session. With static_subscribe: true the static process subscribes, renders, then terminates — subscriptions are cleaned up automatically. The connected process re-subscribes normally on mount.

defmodule MyApp.MyLiveView do
  use Filament.LiveView, static_subscribe: true

  def root_component(), do: MyApp.MyComponent
end

Summary

Functions

Runs pending effects accumulated during the render pass. Attached via attach_hook as an :after_render callback.

Callbacks

root_component()

@callback root_component() :: module()

Functions

run_pending_effects(socket)

Runs pending effects accumulated during the render pass. Attached via attach_hook as an :after_render callback.