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

feat(HMR):update client routes by HMR #472

Merged
merged 2 commits into from
May 17, 2022
Merged

feat(HMR):update client routes by HMR #472

merged 2 commits into from
May 17, 2022

Conversation

pipiduck
Copy link
Contributor

No description provided.

@@ -200,11 +200,39 @@ export const Router: FC<RouterProps> = ({ ssrContext, suspense, createPortal })
events.emit("routerready", { type: "routerready" });

// todo: update routes by hmr
Copy link
Member

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

Copy link
Member

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

},
];
const pathname = (e.routePattern as URLPatternInput).pathname.slice(1);
if (pathname == "_app" || pathname == "_404" || pathname == "_error") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better use "===" instead of "=="

routeRecord[pathname] = route;
}
routeRecord.routes.push(route);
onpopstate({ type: "popstate" });
Copy link
Member

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

@ije
Copy link
Member

ije commented May 17, 2022

LGTM, nice work!

@ije ije merged commit 9f0964a into alephjs:main May 17, 2022
@ije ije mentioned this pull request May 17, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants