Skip to content

Switching from one live view to another with an increased Network latency #4073

@cynthiaaguero

Description

@cynthiaaguero

Environment

  • Elixir version (elixir -v): 1.14
  • Phoenix version (mix deps): 1.7.21
  • Phoenix LiveView version (mix deps): 1.0.17
  • Operating system: macOS 26.0.1
  • Browsers you attempted to reproduce this bug on (the more the merrier): chrome
  • Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: Yes

Actual behavior

When switching from one LiveView to another under artificially increased network latency, LiveView continues to send events from the previous LiveView to the server. Once the new LiveView mounts, those old events no longer exist and Phoenix logs no route or event not found errors.

This results in LiveView trying to handle events on the wrong socket/view.

Expected behavior

When navigating to a new LiveView, any events queued for the previous LiveView should be dropped or ignored.

The new LiveView should not receive events belonging to the previous one, regardless of latency.

An app that reproduces the behavior

https://github.com/adamzaninovich/liveview-messaging-bug-demo

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions