|
@@ -8,6 +8,7 @@ import LoadingIndicator from 'sentry/components/loadingIndicator';
|
|
|
import {t} from 'sentry/locale';
|
|
|
import {Member, Organization} from 'sentry/types';
|
|
|
import useApi from 'sentry/utils/useApi';
|
|
|
+import {useIsMountedRef} from 'sentry/utils/useIsMountedRef';
|
|
|
import useProjects from 'sentry/utils/useProjects';
|
|
|
import useScrollToTop from 'sentry/utils/useScrollToTop';
|
|
|
|
|
@@ -23,6 +24,7 @@ type RouteParams = {
|
|
|
|
|
|
function AlertBuilderProjectProvider(props: Props) {
|
|
|
const api = useApi();
|
|
|
+ const isMountedRef = useIsMountedRef();
|
|
|
const [members, setMembers] = useState<Member[] | undefined>(undefined);
|
|
|
useScrollToTop({location: props.location});
|
|
|
|
|
@@ -48,8 +50,12 @@ function AlertBuilderProjectProvider(props: Props) {
|
|
|
}
|
|
|
|
|
|
// fetch members list for mail action fields
|
|
|
- fetchOrgMembers(api, organization.slug, [project.id]).then(mem => setMembers(mem));
|
|
|
- }, [api, organization, project]);
|
|
|
+ fetchOrgMembers(api, organization.slug, [project.id]).then(mem => {
|
|
|
+ if (isMountedRef.current) {
|
|
|
+ setMembers(mem);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, [api, organization, isMountedRef, project]);
|
|
|
|
|
|
if (!initiallyLoaded || fetching) {
|
|
|
return <LoadingIndicator />;
|