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

Optimize active products (improves navigation performance) #10526

Closed
wants to merge 9 commits into from

Conversation

nwmac
Copy link
Member

@nwmac nwmac commented Feb 28, 2024

This PR makes further optimisations to improve navigation performance - primarily optimising the behaviour of the activeProducts getter in the store.

Essentially, rather than always check whether every product is active, we more intelligently only check the top-level products for the app bar and the root products and its child products in the side nav.

Note, this improves performance, so there were a couple of areas where race conditions mean that things worked, where as with the improved performance, they don't.

On note is the call to onEnter - KubeWarden uses this and access the cluster store, but this was being called before loadCluster was called, so cluster schemas were not available.

@nwmac nwmac added this to the v2.9.0 milestone Feb 28, 2024
@nwmac nwmac changed the title Optimize active products Optimize active products (improves navigation performance) Feb 28, 2024
@nwmac nwmac force-pushed the optimize-active-products branch from 786c834 to 80302ed Compare March 5, 2024 17:22
@nwmac nwmac force-pushed the optimize-active-products branch from 80302ed to c06c394 Compare March 28, 2024 09:42
@nwmac nwmac force-pushed the optimize-active-products branch from c06c394 to b5adf74 Compare April 11, 2024 07:59
@nwmac nwmac marked this pull request as ready for review April 15, 2024 09:09
@nwmac nwmac requested a review from richard-cox April 15, 2024 09:13
@richard-cox
Copy link
Member

Investigated the issue where refreshing whilst in the KubeWarden extension causes a schema not found error

  • auth middleware loads management store --> extension onEnter --> loads cluster store
  • the KW onEnter makes a request to cluster resources before cluster store loaded and throws an schema not found error

This does not happen in master

  • auth middleware --> setProduct --> currentProduct --> type-map/activeProducts --> "rootGetters${ module }/all" --> mutations.registerType(state, type) will create a cluster store schema section (before load cluster store)
  • when KW onEnter then tries to find a schema the cluster schema section exists so no error is thrown

The optimisation in this PR means currentProduct does not call activeProducts and thus the cluster store doesn't get a schema section by the time KW onEnter calls it. TBH this worked by luck, we shouldn't initialise cluster store stuff before the cluster store is set up, and probably need to update kw onEnter given onEnter does not have access to the cluster (we could improve onEnter to handle both post mgmt store and cluster store setup... or improve notifications of this type so extensions can react to other parts of auth middleware process... or something better).

@nwmac nwmac modified the milestones: v2.9.0, v2.10.0 May 7, 2024
@gaktive gaktive modified the milestones: v2.10.0, v2.11.0 Aug 16, 2024
@gaktive
Copy link
Member

gaktive commented Aug 16, 2024

Once Vue3 is landed, we should revisit if this is required.

@nwmac nwmac modified the milestones: v2.12.0, v2.11.0 Nov 1, 2024
@nwmac nwmac modified the milestones: v2.11.0, v2.12.0 Jan 6, 2025
@nwmac nwmac closed this Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants