Skip to content

feat(replay): Capture replays for users without org in context #90788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion static/gsApp/components/organizationHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function OrganizationHeader({organization}: Props) {
const showEmployeeFeedbackButton = !showDevToolbar;

useFeedbackInit();
useReplayInit({organization});
useReplayInit();

return (
<Fragment>
Expand Down
15 changes: 3 additions & 12 deletions static/gsApp/utils/useReplayInit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,15 @@ import type {replayIntegration} from '@sentry/react';
import {getClient} from '@sentry/react';

import {isStaticString} from 'sentry/locale';
import type {Organization} from 'sentry/types/organization';
import {useUser} from 'sentry/utils/useUser';

interface Props {
organization: Organization | null;
}

// Single replayRef across the whole app, even if this hook is called multiple times
let replayRef: ReturnType<typeof replayIntegration> | null;

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

useEffect(() => {
Expand Down Expand Up @@ -84,7 +75,7 @@ export default function useReplayInit({organization}: Props) {
return;
}

if (!organization || !user) {
if (!user) {
return;
}

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

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