You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/phoenix/live_dashboard/page_builder.ex
+41-9Lines changed: 41 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
defmodulePhoenix.LiveDashboard.PageBuilderdo
2
-
@moduledoc"""
2
+
@moduledoc~S'''
3
3
Page builder is the default mechanism for building custom dashboard pages.
4
4
5
5
Each dashboard page is a LiveView with additional callbacks for
@@ -19,7 +19,7 @@ defmodule Phoenix.LiveDashboard.PageBuilder do
19
19
20
20
@impl true
21
21
def render(assigns) do
22
-
~H\"""
22
+
~H"""
23
23
<.live_table
24
24
id="ets-table"
25
25
dom_id="ets-table"
@@ -40,7 +40,7 @@ defmodule Phoenix.LiveDashboard.PageBuilder do
40
40
<%= encode_pid(ets[:owner]) %>
41
41
</:col>
42
42
</.live_table>
43
-
\"""
43
+
"""
44
44
end
45
45
46
46
defp fetch_ets(params, node) do
@@ -108,9 +108,41 @@ defmodule Phoenix.LiveDashboard.PageBuilder do
108
108
109
109
## Custom Hooks
110
110
111
-
If your page needs to register custom hooks, you can use the `register_after_opening_head_tag/2`
112
-
function. Because the hooks need to be available on the dead render in the layout, before the
113
-
LiveView's LiveSocket is configured, your need to do this inside an `on_mount` hook:
111
+
### Colocated Hooks
112
+
113
+
If you're using LiveView 1.1 or later, you can use [**runtime** colocated hooks](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.ColocatedHook.html#module-runtime-hooks):
0 commit comments