Skip to content

[LiveComponent] Fix race condition with inputs being modified during a request#3316

Open
tijnema wants to merge 2 commits intosymfony:2.xfrom
tijnema:feature/preserve-input-during-request
Open

[LiveComponent] Fix race condition with inputs being modified during a request#3316
tijnema wants to merge 2 commits intosymfony:2.xfrom
tijnema:feature/preserve-input-during-request

Conversation

@tijnema
Copy link
Contributor

@tijnema tijnema commented Jan 23, 2026

Q A
Bug fix? yes
New feature? no
Deprecations? no
Documentation? no
Issues Fix #2899
License MIT

As discussed in issue #2899, sometimes form inputs would be cleared. This appears to be a race condition where the input was not sent to the server, but the server response would override the input if it had been modified between request start and morph, even if the server didn't modify anything.

This fixes the issue by checking if an input value is different between now and the value sent to the server, and will then not update the value from the server. Server side changes are still supported, because the code will automatically send a new request for the changed input.

I tried writing a test for it, but so far couldn't reproduce it with a test

@carsonbot carsonbot added Bug Bug Fix LiveComponent Status: Needs Review Needs to be reviewed labels Jan 23, 2026
@github-actions
Copy link
Contributor

📊 Packages dist files size difference

Thanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
Please review the changes and make sure they are expected.

FileBefore (Size / Gzip)After (Size / Gzip)
LiveComponent
live_controller.d.ts 7.96 kB / 1.96 kB 7.99 kB0% / 1.96 kB0%
live_controller.js 99.07 kB / 21.35 kB 100.16 kB+1% 📈 / 21.55 kB+1% 📈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[LiveComponent] Form inputs are sometimes cleared

3 participants