Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants