fix(Projects): Remove N+1 calls to get project environments
Merged
TA
1d ago+297+297+012345678901234567890123456789-115-115-012345678901234567890123456789
Thanks for submitting a PR! Please check the boxes below:
- I have read the Contributing Guide.
- I have added information to
docs/if required so people know about the feature. - I have filled in the "Changes" section below.
- I have filled in the "How did you test this code" section below.
Changes
Closes #7949
Loading the organisation fetched environments for every project, only so project cards could link to the first one. Large organisations hit rate limits. Environments now load when a project is opened.
- N+1 fix: project cards link to
/project/:id;ProjectRedirectPageloads that project's environments and redirects to the first by name. - Permission dialogs: load the selected project's environments themselves, with an error and Try again if they fail (
EmptyStategetsstatus='error'andonRetry). - Project pages wait for
ProjectStore: theApp.jsloader used to finish after every environment loaded, which also coveredProjectStore. Without the N+1 it finishes first, so it now waits for both.
Chromatic: EmptyState's default icon colour moves from #9DA4AE to the colorIconSecondary token (a little darker in light mode), so every empty state shows a small change.
How did you test this code?
- Against staging: the Projects page makes no environment requests; opening a project lands on its first environment; both permission dialogs list the right environments when switching projects, and show Try again on a failed load; with
environments/?project=delayed, identity pages and project settings load correctly. - E2E: new
user-permissions-test.pw.ts. Unit tests for the landing path and environment sort.