-
Notifications
You must be signed in to change notification settings - Fork 166
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
feat(HMR):update client routes by HMR #472
Conversation
framework/react/router.ts
Outdated
@@ -200,11 +200,39 @@ export const Router: FC<RouterProps> = ({ ssrContext, suspense, createPortal }) | |||
events.emit("routerready", { type: "routerready" }); | |||
|
|||
// todo: update routes by hmr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the todo comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you are already fixed it
framework/react/router.ts
Outdated
}, | ||
]; | ||
const pathname = (e.routePattern as URLPatternInput).pathname.slice(1); | ||
if (pathname == "_app" || pathname == "_404" || pathname == "_error") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better use "===" instead of "=="
framework/react/router.ts
Outdated
routeRecord[pathname] = route; | ||
} | ||
routeRecord.routes.push(route); | ||
onpopstate({ type: "popstate" }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont call the onpopstate
in oncreate
callback, call it in the onremove
LGTM, nice work! |
No description provided.