Currently when landing on https://app.flagsmith.com/organisation/:organisationId/projects, the FE iterates over all the projects and requests the environments for each one. For organisations with large numbers of projects this causes a performance overhead at the very least, and rate-limiting at the worst.
The FE should not need to get the environments at this point in the load of the dashboard. The reason that it retrieves them is to know where to route the user to when selecting a project since the next URL is built as https://app.flagsmith.com/project/:projectId/environment/:environmentKey/features (by accessing project.environments[0].api_key.
Some possible solutions to this issue:
- The API returns an
environments list in each Project object returned on /api/v1/projects. The environments list could include:
a. The whole environment object
b. A summary object including the id, api_key and name
c. Just a list of strings giving the api_key attributes of the environments
- The FE retrieves the environments when the user selects a project and then routes the user accordingly
- The BE adds functionality to add a 'default_environment' attribute to the project which the FE can route to
Option (1) would likely be the easiest as it means no refactor on the FE. Option (3) is perhaps the cleanest, but opens the question about whether it would be better to store this preference per user, or maybe use something like last_environment_visited?
Currently when landing on https://app.flagsmith.com/organisation/:organisationId/projects, the FE iterates over all the projects and requests the environments for each one. For organisations with large numbers of projects this causes a performance overhead at the very least, and rate-limiting at the worst.
The FE should not need to get the environments at this point in the load of the dashboard. The reason that it retrieves them is to know where to route the user to when selecting a project since the next URL is built as https://app.flagsmith.com/project/:projectId/environment/:environmentKey/features (by accessing
project.environments[0].api_key.Some possible solutions to this issue:
environmentslist in each Project object returned on/api/v1/projects. Theenvironmentslist could include:a. The whole environment object
b. A summary object including the
id,api_keyandnamec. Just a list of strings giving the
api_keyattributes of the environmentsOption (1) would likely be the easiest as it means no refactor on the FE. Option (3) is perhaps the cleanest, but opens the question about whether it would be better to store this preference per user, or maybe use something like
last_environment_visited?