Skip to content
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
6 changes: 0 additions & 6 deletions static/app/makeLazyloadComponent.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import {OrganizationFixture} from 'sentry-fixture/organization';

import {act, render, screen, userEvent, waitFor} from 'sentry-test/reactTestingLibrary';

import {Link} from 'sentry/components/core/link/link';
Expand Down Expand Up @@ -241,10 +239,6 @@ describe('makeLazyloadComponent', () => {

act(() => {
OrganizationStore.init();
OrganizationStore.onUpdate(
OrganizationFixture({features: ['route-intent-preloading']}),
{replace: true}
);
});
});

Expand Down
10 changes: 3 additions & 7 deletions static/app/scrapsProviders/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ import {LinkBehaviorContextProvider} from '@sentry/scraps/link/linkBehaviorConte

import {preload} from 'sentry/router/preload';
import {useRouteConfig} from 'sentry/router/routeConfigContext';
import OrganizationStore from 'sentry/stores/organizationStore';
import {useLegacyStore} from 'sentry/stores/useLegacyStore';
import {locationDescriptorToTo} from 'sentry/utils/reactRouter6Compat/location';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';
import {useLocation} from 'sentry/utils/useLocation';

export function SentryLinkBehaviorProvider({children}: {children: React.ReactNode}) {
const location = useLocation();
const routeConfig = useRouteConfig();
const {organization} = useLegacyStore(OrganizationStore);
const intentPreloading = organization?.features?.includes('route-intent-preloading');

return (
<LinkBehaviorContextProvider
Expand All @@ -30,21 +26,21 @@ export function SentryLinkBehaviorProvider({children}: {children: React.ReactNod
to: normalizedTo,
onMouseEnter: e => {
onMouseEnter?.(e);
if (routeConfig && intentPreloading) {
if (routeConfig) {
preload(routeConfig, normalizedTo);
}
},
onFocus: e => {
onFocus?.(e);
if (routeConfig && intentPreloading) {
if (routeConfig) {
preload(routeConfig, normalizedTo);
}
},
...props,
};
},
}),
[routeConfig, location, intentPreloading]
[routeConfig, location]
)}
>
{children}
Expand Down
Loading