Commit 51860c0
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 #8178
Task: 5953775
X-original-commit: cdc1728
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>1 parent e4ff47c commit 51860c0
File tree
4 files changed
+27
-11
lines changed- packages/o-spreadsheet-engine/src/plugins/ui_stateful
- tests
- autofill
- sheet
4 files changed
+27
-11
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
Lines changed: 4 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
264 | 258 | | |
265 | 259 | | |
266 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
982 | 983 | | |
983 | 984 | | |
984 | 985 | | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
985 | 994 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
907 | 907 | | |
908 | 908 | | |
909 | 909 | | |
910 | | - | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
911 | 922 | | |
912 | 923 | | |
913 | 924 | | |
| |||
0 commit comments