Skip to content

Commit 2f3fc95

Browse files
Clarifications about nested live views and their appropriate use (#3713)
* Add hint about find_live_child/2 to the live_render docs. * Add a recommendation to try LiveComponent before resorting to a liveview. * Apply suggestions from code review * Update lib/phoenix_component.ex --------- Co-authored-by: Steffen Deusch <[email protected]>
1 parent 1939c20 commit 2f3fc95

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/phoenix_component.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,9 @@ defmodule Phoenix.Component do
946946
947947
* When rendering a LiveView inside a regular (non-live) controller/view.
948948
949+
Most other cases for shared functionality, including state management and user interactions, can be
950+
[achieved with function components or LiveComponents](welcome.html#compartmentalize-state-markup-and-events-in-liveview)
951+
949952
## Options
950953
951954
* `:session` - a map of binary keys with extra session data to be serialized and sent
@@ -1011,6 +1014,11 @@ defmodule Phoenix.Component do
10111014
Beware if you set this to `:body`, as any content injected inside the body
10121015
(such as `Phoenix.LiveReload` features) will be discarded once the LiveView
10131016
connects
1017+
1018+
## Testing
1019+
1020+
Note that `render_click/1` and other testing functions will send events to the root LiveView, and you will want to
1021+
`find_live_child/2` to interact with nested LiveViews in your live tests.
10141022
"""
10151023
def live_render(conn_or_socket, view, opts \\ [])
10161024

0 commit comments

Comments
 (0)