File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,6 +206,17 @@ defmodule Phoenix.LiveView.JS do
206206 it is guaranteed that the event will be pushed first and the patch will only be handled after
207207 the first event was handled by the LiveView.
208208
209+ > #### A note on navigation {: .warning}
210+ >
211+ > When `JS.push` is followed by navigation that replaces the current LiveView,
212+ > such as `JS.navigate`, the navigation may terminate the LiveView while it is
213+ > still handling the pushed event. The commands are executed in order, but the
214+ > event handler is not guaranteed to complete. If the event must finish before
215+ > navigation, initiate the navigation from `handle_event/3` instead, for example
216+ > with `push_navigate/2`.
217+ >
218+ > This does not apply to `JS.patch`, which keeps the current LiveView process running.
219+
209220 '''
210221 alias Phoenix.LiveView.JS
211222
You can’t perform that action at this time.
0 commit comments