Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: single router is not work when route path is customized #6810

Merged
merged 1 commit into from
Feb 26, 2024
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
1 change: 1 addition & 0 deletions packages/runtime/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Patch Changes

- 547601f3: feat: new api of `useActive` for keep alive
- fix: single router dose not work when route path is customized

## 1.4.1

Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/runClientApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ async function render({ history, runtime, needHydrate }: RenderOptions) {
},
};
const SingleComponent = process.env.ICE_CORE_ROUTER !== 'true' &&
await getSingleRoute(routes, basename, routeModuleCache);
await getSingleRoute(routes, basename, location, routeModuleCache);
const renderRoot = appRender(
root,
<AppContextProvider value={appContext}>
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/singleRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
throw new Error('useRevalidator is not supported in single router mode');
};

export const getSingleRoute = async (routes: RouteItem[], basename: string, routeModuleCache = {}) => {
export const getSingleRoute = async (routes: RouteItem[], basename: string, location: Partial<Location> | string, routeModuleCache = {}) => {

Check warning on line 302 in packages/runtime/src/singleRouter.tsx

View workflow job for this annotation

GitHub Actions / build (16.x, ubuntu-latest)

This line has a length of 141. Maximum allowed is 120

Check warning on line 302 in packages/runtime/src/singleRouter.tsx

View workflow job for this annotation

GitHub Actions / build (16.x, windows-latest)

This line has a length of 141. Maximum allowed is 120

Check warning on line 302 in packages/runtime/src/singleRouter.tsx

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-latest)

This line has a length of 141. Maximum allowed is 120

Check warning on line 302 in packages/runtime/src/singleRouter.tsx

View workflow job for this annotation

GitHub Actions / build (18.x, windows-latest)

This line has a length of 141. Maximum allowed is 120
const matchedRoutes = matchRoutes(routes, location, basename);
const routeModules = await loadRouteModules(matchedRoutes.map(({ route }) => route), routeModuleCache);
let loaders = [];
Expand Down
Loading