-
Notifications
You must be signed in to change notification settings - Fork 83
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
[grid-pro] Custom component edit fields contains value of previous edited row for a short moment, when switching edit #2550
[grid-pro] Custom component edit fields contains value of previous edited row for a short moment, when switching edit #2550
Comments
Confirmed that the issue can be reproduced in V14.7.3 as well as the latest V22.0.0.alpha9 so that it isn't a regression. Tried out to reproduce the issue with different editor components. The issue only occured for custom editor components but it didn't for the built-in editor components:
Here is the video with the TextField used as a custom editor component (V22): Screen.Recording.2021-11-01.at.16.14.58.mov |
This is a Flow component issue. The observed delay is the server roundtrip between showing the editor when cell editing starts, and updating the editor with the edited value from the server. This also implies that any ideal solution to this problem will need to avoid a server roundtrip, and run some client-side logic as soon as cell editing starts. Resetting the value of the editor to "empty" is not a trivial problem, because we are dealing with custom elements. Best-case the element has a Given that, I can not see any perfect solution to this problem. I can only list some options that come with different trade-offs: Improve behavior for simple editorsFor cases where the editor itself is an input component, such as Hide editors until the value is loadedMake the custom editor invisible when starting editing, and only show it after the value has loaded. This basically trades the effect of briefly showing the previous value, to the effect of flashing the whole editor. Another concern here is focus management, the web component keeps track of the cell editing state using focus events. So even if the editor is not visible yet, it must already be focused, and must not loose focus until it becomes visible. There might also be accessibility concerns, as the editor still contains the old value, which screen readers might anounce (same problem with the current behavior). That would kind of look this this: Bildschirmaufnahme.2022-03-03.um.13.04.12.mp4Use web components for custom editorsFor complex / composite editors the only way to guarantee a contract for setting a value on the client-side is to use a web component that must implement a |
This could be fixed in the GridPro by not removing the Field immediately but upon grid being refreshed. |
We are currently investigating, if the |
There is also a closely related issue (caused by the same underlying cause), that the regular (non-edit) value in the cell briefly shows the old (pre-edited) value when the editor is closed, before it is updated with the new value. |
So, the plan now is to accept that we cannot do anything about the delay itself, and instead
The design of the loading indicator is still up for discussion. Suggestions welcome. |
Indeterminate circular progress indicator, or something like https://tailwindcss.com/docs/animation#pulse. |
Lumo does have it already '@vaadin/vaadin-lumo-styles/mixins/loader.js'; It is used e.g. in TabSheet |
One idea is to fill the editor with the known client-side value and replace it with the server value as soon as it is known. |
Description
(Preamble: Not sure, if this is a Flow or web component issue. :) )
Edit columns with custom fields show for a very short amount the value of the previously edited row, when switching between two rows. While it is not really a technical issue, it is at least not very appealing visually. This seems to be due to the activation of the edit mode on the client and the async request of the value to show on the server (which takes in the worst case some 100 ms).
Expected outcome
The newly edited field should be empty until the new value is fetched from the server. For this, the grid pro could fetch the default empty value of the custom field and try to apply that first before activating it for the next row to edit.
Minimal reproducible example
Steps to reproduce
Environment
Vaadin 21, Chrome 93
The text was updated successfully, but these errors were encountered: