Skip to content
Open
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
13 changes: 12 additions & 1 deletion static/app/views/sharedGroupDetails/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
9 changes: 7 additions & 2 deletions static/app/views/sharedGroupDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,14 @@ function SharedGroupDetails() {
<span className="icon-sentry-logo-full" />
</Link>
{group.permalink && (
<Link className="details" to={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.
<a className="details" href={group.permalink}>
{t('Details')}
</Link>
</a>
)}
</div>
<div className="box-content">
Expand Down
Loading