Skip to content

Commit a98a3a8

Browse files
authored
fix: Prevent double loading of organization details endpoint (#12818)
1 parent 100400f commit a98a3a8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/sentry/static/sentry/app/views/organizationContext.jsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const OrganizationContext = createReactClass({
6161
};
6262
},
6363

64-
componentWillMount() {
64+
componentDidMount() {
6565
this.fetchData();
6666
},
6767

@@ -71,9 +71,13 @@ const OrganizationContext = createReactClass({
7171
this.props.params.orgId &&
7272
prevProps.params.orgId !== this.props.params.orgId;
7373

74+
const organizationLoadingChanged =
75+
prevProps.organizationsLoading !== this.props.organizationsLoading &&
76+
this.props.organizationsLoading === false;
77+
7478
if (
7579
hasOrgIdAndChanged ||
76-
prevProps.organizationsLoading !== this.props.organizationsLoading ||
80+
organizationLoadingChanged ||
7781
(this.props.location.state === 'refresh' && prevProps.location.state !== 'refresh')
7882
) {
7983
this.remountComponent();

tests/js/spec/views/organizationContext.spec.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ describe('OrganizationContext', function() {
160160

161161
wrapper = createWrapper({
162162
useLastOrganization: true,
163-
params: {},
163+
params: {orgId: 'foo'},
164164
organizationsLoading: true,
165165
organizations: [],
166166
});

0 commit comments

Comments
 (0)