Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Central entity provider for "static" entities #408

Open
shyim opened this issue Dec 15, 2021 · 0 comments
Open

Central entity provider for "static" entities #408

shyim opened this issue Dec 15, 2021 · 0 comments

Comments

@shyim
Copy link

shyim commented Dec 15, 2021

Description
When working in the administration we often have to fetch the same entities across multiple components or pages. Some entities like state_machine_state, state_machine_transition, maybe currency, language, locale are less likely to change over time or at least they change rarely. Such entities could be stored in and provided by a central service/provider to reduce the number of requests.

  • The provider could fetch these entities once when initializing or on demand.
  • The provider could reset/refresh anytime the page reloads.
  • The usage of such a provider is obviously optional, since you can "manually" fetch entities via their repositories. Manual fetching would also still be necessary when requesting specific associations.
  • [bonus] You could let the user configure which entities should/should not be stored that way

Example
Screenshot 2020-09-11 at 14 51 12

We have a filter sidebar for the states of an order, its delivery state and its transaction state. Since these are state_machine_states with different technical_names we either have to fetch all states and filter/manage/distribute them manually in JS, or we have to send multiple requests to fetch the states of each type. Currently we are doing the latter.
When reloading the page you see the duplicated requests (blue). There are also multiple requests that fetch similar "static" entities (language, locale).

Screenshot 2020-09-11 at 14 52 02

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant