fix: prevent client updates when handling events from client#6982
Merged
sissbruecker merged 3 commits intoDec 31, 2024
Conversation
sissbruecker
commented
Dec 20, 2024
Comment on lines
+731
to
+734
| withoutClientUpdate(() -> { | ||
| resizedWidget.setColspan(colspan); | ||
| resizedWidget.setRowspan(rowspan); | ||
| }); |
Contributor
Author
There was a problem hiding this comment.
Changing these implicitly triggers a client update.
| int nodeId = (int) e.getEventData().getNumber(idKey); | ||
| Component removedItem = getItem(nodeId); | ||
| removedItem.removeFromParent(); | ||
| withoutClientUpdate(removedItem::removeFromParent); |
Contributor
Author
There was a problem hiding this comment.
Detaching an item implicitly triggers a client update.
| } | ||
|
|
||
| @Test | ||
| public void moveWidget_noClientUpdate() { |
Contributor
Author
There was a problem hiding this comment.
The test names are somewhat confusing currently, all of them refer to the case of handling a client event, not doing programmatic updates.
vursen
approved these changes
Dec 30, 2024
|
vaadin-bot
pushed a commit
that referenced
this pull request
Dec 31, 2024
* fix: prevent client updates when handling events from client * address sonar issue
sissbruecker
added a commit
that referenced
this pull request
Dec 31, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



When synchronizing state changes from the client to the server (moving items, resizing items, removing items), the dashboard component currently schedules a client update that overrides whatever state currently exists in the client. That means that any client-side changes that have been made during a server-roundtrip can temporarily be reverted and would only be restored after the following server roundtrip.
Assuming that both the WC and the Flow component handle an update in the same way, there is no need to synchronize the server state back to the client when handling an update from the client. To do so, this change prevents executing
updateClientwhen handling updates from the client.Fixes #6962