Skip to content

Unexpected results when pressing a button quickly after editing a field #894

@mofojed

Description

@mofojed

Description

If you have a "submit" button on a field and press the button very quickly after modifying a field, you may not get the latest field.

Steps to reproduce

  1. Run the following:
from deephaven import ui


@ui.component
def ui_my_form():
    value, set_value = ui.use_state('')

    def handle_submit():
        print(f"Value is {value}")
        set_value('')

    return [
        ui.text_field(value=value, label="Name", on_change=set_value),
        ui.button("Submit", on_press=handle_submit),
    ]

my_form = ui_my_form()
  1. Enter a name and really quickly click the "Submit" button

Expected results
2. The value you've entered should be printed, and then it should reset

Actual results
2. A blank value gets printed, and the value doesn't reset

Additional details and attachments

Screencast.from.2024-09-18.16-19-03.mp4

Versions

Engine Version: 0.36.1
Web UI Version: 0.90.0
Java Version: 11.0.24
Barrage Version: 0.6.0
Browser Name: Chrome 128
OS Name: Linux
@deephaven/js-plugin-ui: 0.21.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions