Skip to content

phx-change sends stale params after phx-submit when running inside Cypress browser #4071

@diegonogueira

Description

@diegonogueira

Hi! I’m seeing a strange behavior with phx-change when my LiveView app is opened inside the Cypress browser (E2E runner). The same code works perfectly in a normal browser (Chrome/Firefox) in dev mode.

Environment

  • Elixir version (elixir -v): 1.19.4
  • Phoenix version (mix deps): 1.8.2
  • Phoenix LiveView version (mix deps): 1.1.8
  • Operating system: Linux (Arch)
  • Browsers you attempted to reproduce this bug on (the more the merrier): Chrome, Electron
  • Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: Yes

Actual behavior

When running inside the Cypress browser:

Before the first phx-submit: phx-change behaves correctly.
After the first phx-submit on the form:
phx-change receives stale params (always one change behind).
This results in assigns/HTML also appearing one step behind the actual user input.

Expected behavior

phx-change should always receive the latest input value in params, regardless of whether a phx-submit has already been executed, and regardless of whether the app is opened in a normal browser or inside the Cypress runner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions