Commit b794e26
committed
[FIX] SheetView: dirtify sheet viewport at UPDATE_CELL
the issue was found through an autofill bug. To reproduce:
- Add a data validation checkbox to A1:A2
- Add a format (like `%`) to A1:A2
- autofill A1 into A2
-> crash
What happens?
For starters, the plugin `SheetViewPlugin` is always listening to
selection events and will update the viewports 'scroll' value
accordingly.
During the autofill handling of the command, a bunch of `UPDATE_CELL`
commands are dispatched, which invalidates the whole state of
`HeaderPositionsUIPlugin`.
After that dispatch, the plugin also updates the selection, which
triggers `SheetViewPlugin` to update its viewports but this manipulation
relies on the state of `HeaderPositionsUIPlugin`, which was just invalidated!
It was already known that during a command dispatch, the general state
of plugins might be unstable and `SheetViewPlugin` accounted for it by
*tagging* sheets that might have an unstable state and it would skip the
viewport `scroll` update after selection events.
However, we limited the *tagging* for specific payloads of `UPDATE_CELL`
and the condition set on the style was incorrect. Indeed, a style object
without the `fontSize` does not mean that we do not update the fontsize
but rather that we reset it to its default value which has a direct
impact on the header size and position (hence the invalidation of state
in `HeaderPositionsUIPlugin`.
All-in-all, The presence of the `style` key in the `UPDATE_CELL` command
payload is enough to tag a sheet as invalid.
A side note:
While changing the content or format of a cell can have cross-sheet
impact due to the evaluation process (a cell will take the format of its
reference without a format on its own), it is not the case for the
style. As such, we could make separate cases for commands that update
the content/format, which might theoretically impact every sheet, and
commands that only impact the style, which only impacts the targetted
sheet. Such improvement can target the master dev branch.
closes #7972
Task: 5953775
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>1 parent 5a46aed commit b794e26
File tree
4 files changed
+27
-6
lines changed- src/plugins/ui_stateful
- tests
- autofill
- sheet
4 files changed
+27
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
236 | 235 | | |
237 | 236 | | |
238 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
716 | 717 | | |
717 | 718 | | |
718 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
719 | 728 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
898 | | - | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
899 | 910 | | |
900 | 911 | | |
901 | 912 | | |
| |||
0 commit comments