Skip to content

Commit

Permalink
Refactored outlets
Browse files Browse the repository at this point in the history
  • Loading branch information
smikhalevski committed Jul 12, 2024
1 parent 2e3014b commit 68ef1a0
Show file tree
Hide file tree
Showing 27 changed files with 842 additions and 659 deletions.
4 changes: 3 additions & 1 deletion src/main/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { HTMLAttributes, MouseEvent, ReactElement, useEffect } from 'react';
import { useNavigation } from './hooks';
import { LocationOptions, To } from './types';
import { useNavigation } from './useNavigation';

/**
* Props of the {@link Link} component.
Expand Down Expand Up @@ -62,3 +62,5 @@ export function Link(props: LinkProps): ReactElement {
/>
);
}

Link.displayName = 'Link';
4 changes: 2 additions & 2 deletions src/main/Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ export class Navigation {
*/
prefetch(to: To): boolean {
const location = toLocation(to);
const { routes, context } = this._router.props as RouterProps<unknown>;
const { routes, context } = this._router.props;

const routeMatches = matchRoutes(location.pathname, location.searchParams, routes);

if (routeMatches === null) {
return false;
}
for (const routeMatch of routeMatches) {
routeMatch.route.prefetch(routeMatch.params, context);
routeMatch.route.loader(routeMatch.params, context);
}
return true;
}
Expand Down
Loading

0 comments on commit 68ef1a0

Please sign in to comment.