Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-side value not sent to server in certain cases #20442

Open
tepi opened this issue Nov 11, 2024 · 0 comments
Open

Client-side value not sent to server in certain cases #20442

tepi opened this issue Nov 11, 2024 · 0 comments

Comments

@tepi
Copy link
Contributor

tepi commented Nov 11, 2024

Description of the bug

Pre-requirements: We need a field with a server-side value change handler that takes some time to execute (slow network or artificial sleep when testing) and at the end sets the field value to a pre-set value.

        Input input2 = new Input();
        input2.addValueChangeListener(e -> {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException ex) {
                throw new RuntimeException(ex);
            }
            input2.setValue("fromserver");
        });

Steps to reproduce the issue:

  1. Select the field, type in 1 and press enter -> value should be "fromserver".
  2. Type 1 at the end of the field and press enter. Then quickly type 2 at the end of the field while the thread is sleeping. Value should briefly be "fromserver12" and once the round-trip completes it should be reset to "fromserver".
  3. Now type 1 at the end of the field (value should be "fromserver1") and press enter -> nothing happens

Issue was found while fixing #20365 via #20431

Expected behavior

After pressing enter in step three above, the value "fromserver1" should be sent to the server but it is not.

Minimal reproducible example

Can be quite easily demonstrated with test code here https://github.com/vaadin/flow/pull/20431/files#diff-9c44f8ed3265aa1d33149204e10dacbcd207f8943114e161470c64f7509595d7

But note this happens on current main and on the above PR branch so the issue is not introduced by that PR.

Versions

  • Vaadin / Flow version: 24.6-SNAPSHOT (probably earlier versions as well, did not check yet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔖 Normal Priority (P2)
Development

No branches or pull requests

1 participant