Skip to content

Commit 607a32b

Browse files
authored
feat(replay): Capture replays for users without org in context (#90788)
We have some errors that do not have any replays bc the user does not have any orgs. Previously we checked feature flags before deciding to record a replay, but those have been removed, so there is no need to check the org at all.
1 parent 6572841 commit 607a32b

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

static/gsApp/components/organizationHeader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function OrganizationHeader({organization}: Props) {
1818
const showEmployeeFeedbackButton = !showDevToolbar;
1919

2020
useFeedbackInit();
21-
useReplayInit({organization});
21+
useReplayInit();
2222

2323
return (
2424
<Fragment>

static/gsApp/utils/useReplayInit.tsx

+3-12
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,15 @@ import type {replayIntegration} from '@sentry/react';
44
import {getClient} from '@sentry/react';
55

66
import {isStaticString} from 'sentry/locale';
7-
import type {Organization} from 'sentry/types/organization';
87
import {useUser} from 'sentry/utils/useUser';
98

10-
interface Props {
11-
organization: Organization | null;
12-
}
13-
149
// Single replayRef across the whole app, even if this hook is called multiple times
1510
let replayRef: ReturnType<typeof replayIntegration> | null;
1611

1712
/**
1813
* Load the Sentry Replay integration based on the feature flag.
19-
*
20-
* Can't use `useOrganization` because it throws on
21-
* `/settings/account/api/auth-token/` because organization is not *immediately*
22-
* set in context
2314
*/
24-
export default function useReplayInit({organization}: Props) {
15+
export default function useReplayInit() {
2516
const user = useUser();
2617

2718
useEffect(() => {
@@ -84,7 +75,7 @@ export default function useReplayInit({organization}: Props) {
8475
return;
8576
}
8677

87-
if (!organization || !user) {
78+
if (!user) {
8879
return;
8980
}
9081

@@ -95,5 +86,5 @@ export default function useReplayInit({organization}: Props) {
9586

9687
// NOTE: if this component is unmounted (e.g. when org is switched), we will continue to record!
9788
// This can be changed by calling `stop/start()` on unmount/mount respectively.
98-
}, [organization, user]);
89+
}, [user]);
9990
}

0 commit comments

Comments
 (0)