Skip to content

Conversation

@davidenwang
Copy link
Contributor

Due to how we fetch teams on the frontend we only load up to 100 into the TeamStore at app start. Only a handful of orgs have over 100 teams, but it still poses a problem for using certain features such as team key transactions. To fix this, we replace withTeams in favor of the Teams utility which handles fetching the correct teams and propagating changes back to the store to prevent duplicate fetching.

image

This PR replaces instances of withTeams in team key transactions with Teams whilst preserving the functionality. In some cases we have to add a loading spinner in the event that we don't have the user team's loaded in the team store.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2021

size-limit report

Path Base Size (53f99d3) Current Size Change
src/sentry/static/sentry/dist/entrypoints/app.js 52.72 KB 52.76 KB +0.08% 🔺
src/sentry/static/sentry/dist/entrypoints/sentry.css 70.89 KB 70.89 KB 0%

Copy link
Member

@Zylphrex Zylphrex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the useTeams hook handle super users the same way? Previously, just filtering for isMember ignores super users privileges so we had to check isActiveSuperuser() as well.

}

export const PerformanceLanding = withTeams(_PerformanceLanding);
export const PerformanceLanding = _PerformanceLanding;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We can rename _PerformanceLanding to PerformanceLanding and directly export it now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good i'll refactor. Also, dang thanks for pointing out the superuser logic. We actually do fetch all teams if you're a superuser, but in the hook we're filtering it down to just teams where isMember is true. fixing here: #29294

@davidenwang davidenwang force-pushed the davidenwang/use-teams-team-key-transaction branch from b5bc68b to 75830ae Compare November 3, 2021 22:01
@davidenwang davidenwang enabled auto-merge (squash) November 3, 2021 22:08
@davidenwang davidenwang merged commit 89e171a into master Nov 3, 2021
@davidenwang davidenwang deleted the davidenwang/use-teams-team-key-transaction branch November 3, 2021 22:29
@github-actions github-actions bot locked and limited conversation to collaborators Nov 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants