Skip to content

Use stores' state to its full potential #10966

@brian-mulier-p

Description

@brian-mulier-p

Describe the issue

Currently, we tend not to check if a given variable in the state is populated in actions and do an API call whatever the state currently is (for eg. plugins) leading to duplicate calls while we already have the info. It impacts users that are staying for a long time on the UI not refreshing because they could benefit from a stateful application as they browse the UI with lower loading times.

In actions we should check if it's some data that are worth being kept in state, if that's the case then add some if (state.a !== undefined) return state.a to avoid redoing the fetch.

This could take some time and lead to undesired behavior but in that case maybe keeping a state for a variable that is changing between each calls is not desired.
Most likely there will be cases where we could use the state but under the condition that each "root" component properly unmounts and reset its state variables so that the action is able to know that it should do the fetch again.

Environment

  • Kestra Version: develop

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/frontendNeeds frontend code changesenhancementNew feature or requestkind/cooldownGreat candidate for the cooldown periodkind/performancePerformance-related issue

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions