Skip to content

Commit

Permalink
fix: compatible when undefined basename (#6780)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClarkXia authored Feb 1, 2024
1 parent 0d31ab4 commit 57ecf19
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/runtime/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @ice/runtime

## 1.4.1

- fix: compatible with basename is undefined.

## 1.4.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ice/runtime",
"version": "1.4.0",
"version": "1.4.1",
"description": "Runtime module for ice.js",
"type": "module",
"types": "./esm/index.d.ts",
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime/src/singleRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ RouteContext.displayName = 'RouteContext';

export function useData<T = any>(): T {
const value = React.useContext(RouteContext);
console.log('use value', value);
return value.routeData?.data;
}

Expand Down Expand Up @@ -259,7 +258,7 @@ export const matchRoutes = (
basename: string,
) => {
const pathname = typeof location === 'string' ? location : location.pathname;
const stripedPathname = stripBasename(pathname || '/', basename);
const stripedPathname = stripBasename(pathname || '/', basename || '/');
let branches = flattenRoutes(routes);
if (branches.length === 1) {
// Just one branch, no need to match.
Expand Down

0 comments on commit 57ecf19

Please sign in to comment.