fix(frontend): avoid PermissionsTabs crash before projects load#6993
fix(frontend): avoid PermissionsTabs crash before projects load#6993saudademjj wants to merge 2 commits intoFlagsmith:mainfrom
Conversation
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.
Once credits are available, reopen this pull request to trigger a review.
|
@saudademjj is attempting to deploy a commit to the Flagsmith Team on Vercel. A member of the Team first needs to authorize it. |
|
Code-side checks look healthy on my side: |
|
The failing checks are all Vercel deployments, each reporting "Authorization required to deploy". The code checks themselves are passing. |
|
Hey @saudademjj, thanks for picking this up and for the thorough testing writeup! The fix is spot on 🎯 A couple of small suggestions: 1. Use
- mainItems={(projectData || []).map((v) => ({
+ mainItems={(projectData ?? []).map((v) => ({2. Drop the test file for now We really appreciate the effort of adding a regression test — that's the right instinct! In this case though, the component is tightly coupled to We're planning to decouple the store dependency down the line (e.g. passing |
- Replace || with ?? for projectData fallback - Remove PermissionsTabs.test.ts per review feedback
|
Good points — updated: swapped to |
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Closes #6553
OrganisationStore.getProjects()returningundefinedbefore the organisation data has loadedPermissionsTabskeeps rendering with an empty project list instead of throwingHow did you test this code?
100.92.89.12via Dockernode:22, rannpm run test:unit -- --runInBand web/components/__tests__/PermissionsTabs.test.ts100.92.89.12via Dockernode:22, rannpx eslint web/components/PermissionsTabs.tsx web/components/__tests__/PermissionsTabs.test.tsnpm run typecheckcurrently fails on the repository baseline with many unrelated frontend errors onmain; I did not change those files and did not treat them as blockers for this focused fix