diff --git a/static/app/views/sharedGroupDetails/index.spec.tsx b/static/app/views/sharedGroupDetails/index.spec.tsx index 60834dfba91c..1e821ed3a5eb 100644 --- a/static/app/views/sharedGroupDetails/index.spec.tsx +++ b/static/app/views/sharedGroupDetails/index.spec.tsx @@ -70,7 +70,18 @@ describe('SharedGroupDetails', () => { route: '/organizations/:orgId/share/issue/:shareId/', }, }); - expect(await screen.findByText('Details')).toBeInTheDocument(); + // The "Details" link must be a hard-navigation anchor (not a React Router + // Link) so clicking it triggers a full page load and the issue detail route + // boots with the correct org context. An in-app navigation would unmount + // this page's OrganizationContext, leaving child components that call + // useOrganization() with a null context and causing them to throw. + const detailsLink = await screen.findByRole('link', {name: 'Details'}); + expect(detailsLink).toBeInTheDocument(); + expect(detailsLink.tagName).toBe('A'); + expect(detailsLink).toHaveAttribute( + 'href', + 'https://foo.io/organizations/foo/issues/1234/' + ); expect(await screen.findByTestId('sgh-timestamp')).toBeInTheDocument(); }); diff --git a/static/app/views/sharedGroupDetails/index.tsx b/static/app/views/sharedGroupDetails/index.tsx index 2f994596b8a6..7d3c293018d3 100644 --- a/static/app/views/sharedGroupDetails/index.tsx +++ b/static/app/views/sharedGroupDetails/index.tsx @@ -92,9 +92,14 @@ function SharedGroupDetails() { {group.permalink && ( - + // Use a hard navigation (not React Router in-app nav) so the + // app re-bootstraps with the correct org context. An in-app + // navigation unmounts this page's OrganizationContext before + // the issue detail route has a chance to load its own, causing + // useOrganization() calls in child components to throw. + {t('Details')} - + )}