Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/phoenix_live_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,8 @@ defmodule Phoenix.LiveView do
handling the given `event`. If you need to scope events, then
this must be done by namespacing them.

Events pushed during `push_navigate` are currently discarded,
as the LiveView is immediately dismounted.
Events pushed during `push_navigate` (or any redirect) are sent to the
client before the redirection happens.

## Hook example

Expand Down
9 changes: 5 additions & 4 deletions lib/phoenix_live_view/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,11 @@ defmodule Phoenix.LiveView.Utils do
@doc """
Annotates the changes with the event to be pushed.

By default, events are dispatched on the JavaScript side only after
the current patch is invoked. Therefore, if the LiveView
redirects, the events won't be invoked. If the `dispatch: :before` option
is passed, this event will be dispatched before patching the DOM.
By default, events are dispatched on the JavaScript side after
the current patch is invoked. If the LiveView redirects,
any pending events are dispatched before the redirection occurs.
If the `dispatch: :before` option is passed, this event will be
dispatched before patching the DOM.
"""
def push_event(%Socket{} = socket, event, %{} = payload, opts) do
opts = Keyword.validate!(opts, [:dispatch])
Expand Down
Loading