-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[18.0][FIX] web_widget_x2many_2d_matrix: refresh totals on cell edit #3413
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
base: 18.0
Are you sure you want to change the base?
[18.0][FIX] web_widget_x2many_2d_matrix: refresh totals on cell edit #3413
Conversation
|
Hi @JasminSForgeFlow, @DavidJForgeFlow, @hbrunn, |
JasminSForgeFlow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review 👍
hbrunn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't do this. The widget as is is already pretty expensive computationally, and this PR makes it much worse.
Please replace all of this with
onWillRender(() => {
this.columns = this._getColumns();
this.rows = this._getRows();
this.matrix = this._getMatrix();
});in setup() instead of onWillUpdateProps, this should get the caching right and won't add several times o(n^2) complexity.
Also consider expanding the test to edit a field several times and check if the totals are updated correctly
Okay! |
cb87b79 to
ecbd1a0
Compare
Totals were not consistently refreshing immediately on cell edits because the renderer logic relied on expensive getters that caused redundant computations per render cycle and lacked proper reactivity. - Refactor X2Many2DMatrixRenderer to use the `onWillRender` hook, computing all matrix data (rows, columns, and cells) once per render cycle. This ensures totals update immediately when a cell value changes and significantly improves performance. - Expand the JS test suite with a robust case verifying totals after multiple consecutive edits. - Adapt tests to the Odoo 18 Hoot framework using `contains` and `queryAll`.
ecbd1a0 to
64dce27
Compare
Hi @hbrunn I changed the |
Totals were only recomputed on initial render or after saving because the renderer cached matrix/rows/columns and only rebuilt them on props updates.
2026-01-15.11-46-33.mp4
Compute matrix data from reactive list.records on each render so row/column/grand totals update immediately when a cell value changes.
2026-01-15.11-44-07.mp4