Skip to content

Commit

Permalink
Change name to loaderData for individual match
Browse files Browse the repository at this point in the history
  • Loading branch information
jhsware committed Dec 28, 2022
1 parent d835024 commit ef22aae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/inferno-router/src/Route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface Match<P extends Record<string, string>> {
path: string;
url: string;
loader?(props: TLoaderProps<P>): Promise<any>;
initialData?: TLoaderData;
loaderData?: TLoaderData;
}

export interface RouteComponentProps<P extends Record<string, string>> {
Expand Down Expand Up @@ -49,7 +49,7 @@ class Route extends Component<Partial<IRouteProps>, RouteState> {
const match = this.computeMatch(props, context.router);
this.state = {
match,
__loaderData__: match?.initialData,
__loaderData__: match?.loaderData,
};
}

Expand Down Expand Up @@ -101,7 +101,7 @@ class Route extends Component<Partial<IRouteProps>, RouteState> {

this.setState({
match,
__loaderData__: match?.initialData,
__loaderData__: match?.loaderData,
});
}

Expand Down
4 changes: 2 additions & 2 deletions packages/inferno-router/src/matchPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function matchPath(pathname, options: any): Match<any> | null {
return null;
}

const intialDataEntry = initialData[path];
const loaderData = initialData[path];

const [url, ...values] = match;
const isExact = pathname === url;
Expand All @@ -59,6 +59,6 @@ export function matchPath(pathname, options: any): Match<any> | null {
path, // the path pattern used to match
url: path === '/' && url === '' ? '/' : url, // the matched portion of the URL
loader,
initialData: intialDataEntry
loaderData,
};
}

0 comments on commit ef22aae

Please sign in to comment.