Skip to content
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

[IMP] Dashboard: Cache clickable cells #4090

Closed
wants to merge 1 commit into from

Conversation

rrahir
Copy link
Collaborator

@rrahir rrahir commented Apr 17, 2024

Description:

The computation of the clickable cells visibility condition can
sometimes be costy (per cell). At the moment, we recompute those
conditions at each rendering request, which can become quickly costy
if we simply scroll the viewport.

This revision introduces a caching of this computations to smooth out
the user experience when scrolling a dashboard.

Task: 3869752

Task: : 3869752

review checklist

  • feature is organized in plugin, or UI components
  • support of duplicate sheet (deep copy)
  • in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • in model/UI: ranges are strings (to show the user)
  • undo-able commands (uses this.history.update)
  • multiuser-able commands (has inverse commands and transformations where needed)
  • new/updated/removed commands are documented
  • exportable in excel
  • translations (_t("qmsdf %s", abc))
  • unit tested
  • clean commented code
  • track breaking changes
  • doc is rebuild (npm run doc)
  • status is correct in Odoo

@rrahir rrahir changed the base branch from 17.0 to master April 17, 2024 08:37
@robodoo
Copy link
Collaborator

robodoo commented Apr 17, 2024

@rrahir rrahir force-pushed the master-clickable-store-rar branch from b9cda0c to 489742f Compare April 17, 2024 10:23
@rrahir rrahir changed the title Master clickable store rar [IMP] Dashboard: Cache clickable cells Apr 17, 2024
@rrahir rrahir force-pushed the master-clickable-store-rar branch from 489742f to 5a99f26 Compare April 17, 2024 13:26
Copy link
Contributor

@hokolomopo hokolomopo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Faster dashboards 👀

The Odoo's PR is missing tho

if (
invalidateEvaluationCommands.has(cmd.type) ||
cmd.type === "EVALUATE_CELLS" ||
(cmd.type === "UPDATE_CELL" && cmd.content)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also need to check cmd.format theoritically (=CELL formula)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why? Not sure how a change in the format could have an impact on the clickable cell features.
Now, assuming you are right, I guess we should factorize this kind of condition because I think it's not clear :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


private findClickableAction(position: CellPosition) {
const getters = this.getters;
for (const item of clickableCellRegistry.getAll().sort((a, b) => a.sequence - b.sequence)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a non-factor because the registry isn't big, be we create a new array + sort it at each call of this method

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be better 👍

if (getters.isInMerge(position)) {
zone = getters.getMerge(position)!;
} else {
zone = positionToZone({ col, row });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
zone = positionToZone({ col, row });
zone = positionToZone(position);

nitpick

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also nitpick: this could be a ternary

const rect = getters.getVisibleRect(zone);
cells.push({
coordinates: rect,
position: position,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still nitpicking

Suggested change
position: position,
position,

Comment on lines 70 to 72
let zone: Zone;
if (getters.isInMerge(position)) {
zone = getters.getMerge(position)!;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of emrges, we will re-compute this.getClickableAction for each cell of the merge, and have a ClickableCell with the same zone for each cell right ? That doesn't seems right ... (we love merges)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed that it's a waste of resource but not fundamentally wrong ^^

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be fixed in prior versions as well actually

rrahir added a commit to odoo-dev/odoo that referenced this pull request May 6, 2024
Following odoo/o-spreadsheet#4090,
Some helpers are adapted to suit their use with the clickable cell
refactoring.

task-3869752
The computation of the clickable cells visibility condition can
sometimes be costy (per cell). At the moment, we recompute those
conditions at each rendering request, which can become quickly costy
if we simply scroll the viewport.

This revision introduces a caching of this computations to smooth out
the user experience when scrolling a dashboard.

Task: 3869752
@rrahir rrahir force-pushed the master-clickable-store-rar branch from 5a99f26 to 8f5be05 Compare May 6, 2024 06:53
Copy link
Collaborator

@LucasLefevre LucasLefevre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

robodoo r+

robodoo pushed a commit that referenced this pull request May 10, 2024
The computation of the clickable cells visibility condition can
sometimes be costy (per cell). At the moment, we recompute those
conditions at each rendering request, which can become quickly costy
if we simply scroll the viewport.

This revision introduces a caching of this computations to smooth out
the user experience when scrolling a dashboard.

closes #4090

Task: 3869752
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
@robodoo robodoo closed this May 10, 2024
@robodoo robodoo added the 17.3 label May 10, 2024
pro-odoo pushed a commit to odoo-dev/odoo that referenced this pull request May 13, 2024
Following odoo/o-spreadsheet#4090,
Some helpers are adapted to suit their use with the clickable cell
refactoring.

task-3869752
pro-odoo pushed a commit to odoo-dev/odoo that referenced this pull request May 14, 2024
Following odoo/o-spreadsheet#4090,
Some helpers are adapted to suit their use with the clickable cell
refactoring.

task-3869752
pro-odoo pushed a commit to odoo-dev/odoo that referenced this pull request May 14, 2024
Following odoo/o-spreadsheet#4090,
Some helpers are adapted to suit their use with the clickable cell
refactoring.

task-3869752
pro-odoo pushed a commit to odoo-dev/odoo that referenced this pull request May 15, 2024
Following odoo/o-spreadsheet#4090,
Some helpers are adapted to suit their use with the clickable cell
refactoring.

task-3869752
pro-odoo pushed a commit to odoo-dev/odoo that referenced this pull request May 15, 2024
Following odoo/o-spreadsheet#4090,
Some helpers are adapted to suit their use with the clickable cell
refactoring.

task-3869752
pro-odoo pushed a commit to odoo-dev/odoo that referenced this pull request May 15, 2024
Following odoo/o-spreadsheet#4090,
Some helpers are adapted to suit their use with the clickable cell
refactoring.

task-3869752
pro-odoo pushed a commit to odoo-dev/odoo that referenced this pull request May 15, 2024
Following odoo/o-spreadsheet#4090,
Some helpers are adapted to suit their use with the clickable cell
refactoring.

task-3869752
pro-odoo pushed a commit to odoo-dev/odoo that referenced this pull request May 16, 2024
Following odoo/o-spreadsheet#4090,
Some helpers are adapted to suit their use with the clickable cell
refactoring.

task-3869752
robodoo pushed a commit to odoo/odoo that referenced this pull request May 16, 2024
Following odoo/o-spreadsheet#4090,
Some helpers are adapted to suit their use with the clickable cell
refactoring.

task-3869752

Part-of: #163358
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants