Skip to content

Commit

Permalink
fix: fix remixRouter not existed in conventional routes (#4240)
Browse files Browse the repository at this point in the history
* fix: fix remixRouter not existed in conventional routes

* chore: changeset
  • Loading branch information
xuchaobei authored Jul 18, 2023
1 parent 67d0b0c commit fb51b98
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/ninety-tables-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modern-js/runtime': patch
---

fix: fix remixRouter not existed in conventional routes
fix: 修复 remixRouter 在约定式路由下不存在问题
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,16 @@ export const routerPlugin = ({
pickContext: ({ context, pickedContext }, next) => {
const { remixRouter } = context;

// remixRouter is not existed in conventional routes
if (!remixRouter) {
return next({ context, pickedContext });
}

// only export partial common API from remix-router
const router = {
navigate: remixRouter!.navigate,
navigate: remixRouter.navigate,
get location() {
return remixRouter!.state.location;
return remixRouter.state.location;
},
};

Expand Down

0 comments on commit fb51b98

Please sign in to comment.