Commit cdc1728
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 #8169
Task: 5953775
X-original-commit: b794e26
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>1 parent c98ebc5 commit cdc1728
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 | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
243 | 242 | | |
244 | 243 | | |
245 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
951 | 952 | | |
952 | 953 | | |
953 | 954 | | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
954 | 963 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
910 | 910 | | |
911 | 911 | | |
912 | 912 | | |
913 | | - | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
914 | 925 | | |
915 | 926 | | |
916 | 927 | | |
| |||
0 commit comments