Commit 75ceaa4
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 #8189
Task: 5953775
X-original-commit: a962b50
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>1 parent 67fec55 commit 75ceaa4
File tree
4 files changed
+28
-6
lines changed- packages/o-spreadsheet-engine/src/plugins/ui_stateful
- tests
- autofill
- sheet
4 files changed
+28
-6
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: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
261 | 263 | | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
900 | 901 | | |
901 | 902 | | |
902 | 903 | | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
903 | 912 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
888 | 888 | | |
889 | 889 | | |
890 | 890 | | |
891 | | - | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
892 | 903 | | |
893 | 904 | | |
894 | 905 | | |
| |||
0 commit comments