-
Notifications
You must be signed in to change notification settings - Fork 729
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
Component in grid header is not displayed correctly #12622
Comments
This might be related to a situation similar to the one in #12608 |
Does adding |
Hello @Ansku, thank you, it helps. Can you explain what is round trip and why we should use |
Sorry for the delay, missed the comment! Roundtrip means a single message cycle from server to client and back -- or the other way around, if the roundtrip starts from the client, but the helper method is only for server-originated roundtrips. So in this case, the server starts the roundtrip and tells the client that the component has been added to the Grid header, and the client completes the roundtrip by sending back an acknowledgement that it has got that particular bunch of messages and has finished the immediate round of processing for all of them, which means that the component is now registered on the client as well and will be taken into account in any future size calculations. Only Grid doesn't actually send those sorts of confirmation messages from the client, it just registers the component and adds it to the DOM and is satisfied with that, so you need the helper method to learn that the processing actually did get started. The The helper method sends its own message to the client in the same bunch of messages with your other commands (adding the component) when the round-trip starts, and has a client-side counterpart that sends an answer from the client in the returning bunch of messages. And when that answering message arrives, it executes the callback you gave the helper method as a parameter. Even if the answering message isn't from Grid specifically, the entire bunch of messages from server to client is processed before any of the answering bunch or messages are sent back from client to server, so you know that Grid's client-side has also received knowledge of the component already. If you try to recalculate the widths before the component has been properly added and populated, you'll probably get wrong results, hence the delay. Listening to the roundtrip is also more robust than just adding some fixed delay before triggering the recalculation, since the roundtrip adjusts to any slowness in the environment. You can also give the |
@Ansku thanks for the detailed explanation |
Vaadin Framework version - 8.24.0
Google Chrome Version 125.0.6422.77 (Official Build) (64-bit)
Windows 11 Enterprise Version 23H2
Component in grid header is not displayed correctly if you set it from background thread.
To reproduce bug you should change header from background thread:
Push mode is
@Push(value = PushMode.MANUAL, transport = Transport.LONG_POLLING)
Also you can find full code in repo-vaadin8-component-in-grid-header-bug.
The text was updated successfully, but these errors were encountered: