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] web, onboarding: avoid unneccessary rpc request #143212

Closed

Conversation

fdardenne
Copy link
Contributor

@fdardenne fdardenne commented Nov 22, 2023

The OnboardingBanner is a component that allows having banner in
views. For example you can find banners in Accounting->Invoices,
Calendar, ...

[IMP] onboarding: use session_info to avoid unnecessary requests

The OnboardingBanner component fetch from the server the html
to display in the banner.

However we would like to avoid the following unnecessary requests:

  • When the banner is closed
  • When the user do not have the right to display the banner (not in the base.group_system group)

This commit avoid thoses unnecessary requests for the /onboarding/*
routes by storing the displayable banner in the session_info.

This optimization is made to the generic /onboarding route because
this route is linked to the onboarding.onboarding model and each
record specify if the steps are done and if the banner is manually
closed. Additionally, we know that this route is only accessible for
user with base.group_system group.


On a side note, in #141110 we tried to make OnboardingBanner rpc fetching asynchronous. Allowing views to render without the need of waiting the rpc response of the banner.
Unfortunately it caused a flickering, i.e. the banner was rendered after the view leading to the repositioning of user interface elements. For the moment it is not possible to show a skeleton to avoid such flickering because the client does not know the height of the banner without the rpc answer.

task-id: 3561730

@robodoo
Copy link
Contributor

robodoo commented Nov 22, 2023

Pull request status dashboard.

@C3POdoo C3POdoo added the RD research & development, internal work label Nov 22, 2023
@fdardenne fdardenne force-pushed the master-onboarding-optimization-dafl branch 16 times, most recently from bd7fd74 to c6fdd5f Compare December 6, 2023 12:30
@fdardenne fdardenne marked this pull request as ready for review December 6, 2023 12:32
@C3POdoo C3POdoo requested review from a team, caburj and Julien00859 and removed request for a team December 6, 2023 12:32
Copy link
Contributor

@flch-odoo flch-odoo left a comment

Choose a reason for hiding this comment

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

Thanks for the changes @fdardenne ;

I wonder if we shouldn't also have a time limit to this cache to keep the perf improvement but also allow more frequent refreshes as other admins could interact with the steps as well and we would "never" see it.

Maybe a few hours?

@fdardenne fdardenne force-pushed the master-onboarding-optimization-dafl branch 2 times, most recently from b1202a0 to fcafded Compare December 18, 2023 14:24
@bouvyd
Copy link
Contributor

bouvyd commented Dec 22, 2023

I wonder if we shouldn't also have a time limit to this cache to keep the perf improvement but also allow more frequent refreshes as other admins could interact with the steps as well and we would "never" see it.

my 2cents here: whilst you're technically correct that this could lead to desynchronization, i don't think this is worth the hassle for the following reasons:

  • it's rare to have more than one admin setting up a db at the same time
  • even if that happens, a refresh would solve it

As long as it's ultimately consistent, i think it's fine. no need to make the solution more complex for this.

@fdardenne fdardenne force-pushed the master-onboarding-optimization-dafl branch 7 times, most recently from f9aa270 to 95e4304 Compare January 3, 2024 10:55
@fdardenne fdardenne force-pushed the master-onboarding-optimization-dafl branch from 95e4304 to 04f59dd Compare January 10, 2024 12:32
addons/onboarding/__manifest__.py Outdated Show resolved Hide resolved
addons/onboarding/models/ir_http.py Show resolved Hide resolved
addons/onboarding/models/ir_http.py Outdated Show resolved Hide resolved
addons/onboarding/models/ir_http.py Outdated Show resolved Hide resolved
addons/onboarding/static/src/views/onboarding_banner.js Outdated Show resolved Hide resolved
addons/web/static/src/views/onboarding_service.js Outdated Show resolved Hide resolved
addons/web/static/src/views/onboarding_service.js Outdated Show resolved Hide resolved
@fdardenne fdardenne force-pushed the master-onboarding-optimization-dafl branch 6 times, most recently from 39c7e76 to 2f6bb6e Compare January 10, 2024 19:04
addons/onboarding/models/ir_http.py Outdated Show resolved Hide resolved
The OnboardingBanner is a component that allows having banner in
views. For example you can find banners in Accounting->Invoices,
Calendar, ...

To do that, the OnboardingBanner component fetch from the server the html
to display in the banner.

However we would like to avoid the following unnecessary requests:
- When the banner is closed
- When the user do not have the right to display the banner (not in the
    `base.group_system group`)

This commit avoid thoses unnecessary requests for the `/onboarding/*`
routes by storing the displayable banner in the session_info.

This optimization is made to the generic `/onboarding` route because
this route is linked to the `onboarding.onboarding` model and each
record specify if the steps are done and if the banner is manually
closed. Additionally, we know that this route is only accessible for
user with `base.group_system` group.

task-id: 3561730
@fdardenne fdardenne force-pushed the master-onboarding-optimization-dafl branch from 2f6bb6e to dd4fff8 Compare January 11, 2024 12:15
Copy link
Contributor

@aab-odoo aab-odoo 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 Jan 11, 2024
The OnboardingBanner is a component that allows having banner in
views. For example you can find banners in Accounting->Invoices,
Calendar, ...

To do that, the OnboardingBanner component fetch from the server the html
to display in the banner.

However we would like to avoid the following unnecessary requests:
- When the banner is closed
- When the user do not have the right to display the banner (not in the
    `base.group_system group`)

This commit avoid thoses unnecessary requests for the `/onboarding/*`
routes by storing the displayable banner in the session_info.

This optimization is made to the generic `/onboarding` route because
this route is linked to the `onboarding.onboarding` model and each
record specify if the steps are done and if the banner is manually
closed. Additionally, we know that this route is only accessible for
user with `base.group_system` group.

closes #143212

Task-id: 3561730
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
@robodoo robodoo added the 17.1 label Jan 11, 2024
@robodoo robodoo closed this Jan 11, 2024
@fw-bot fw-bot deleted the master-onboarding-optimization-dafl branch January 25, 2024 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
17.1 RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants