Skip to content

Commit

Permalink
fix hydrate element type error
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWangJustToDo committed Dec 14, 2023
1 parent c37d531 commit c08f64e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/myreact-dom/src/client/api/create/getHydrateDom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ const checkHydrateDom = (fiber: MyReactFiberNode, dom?: ChildNode) => {
if (include(fiber.type, NODE_TYPE.__plain__)) {
if (dom.nodeType !== Node.ELEMENT_NODE) {
if (enableHydrateWarn.current) {
log(fiber, "error", `hydrate error, dom not match from server. server: "<${dom.nodeName.toString()} />", client: "${getElementName(fiber)}"`);
log(fiber, "error", `hydrate error, dom not match from server. server: "<${dom.nodeName.toLowerCase()} />", client: "${getElementName(fiber)}"`);
}
return false;
}
if (fiber.elementType.toString() !== dom.nodeName.toString()) {
if (fiber.elementType.toString().toLowerCase() !== dom.nodeName.toLowerCase()) {
if (enableHydrateWarn.current) {
log(fiber, "error", `hydrate error, dom not match from server. server: "<${dom.nodeName.toString()} />", client: "${getElementName(fiber)}"`);
log(fiber, "error", `hydrate error, dom not match from server. server: "<${dom.nodeName.toLowerCase()} />", client: "${getElementName(fiber)}"`);
}
return false;
}
Expand All @@ -75,7 +75,7 @@ const checkHydrateDom = (fiber: MyReactFiberNode, dom?: ChildNode) => {
if (include(fiber.type, NODE_TYPE.__comment__)) {
if (dom.nodeType !== Node.COMMENT_NODE) {
if (enableHydrateWarn.current) {
log(fiber, "error", `hydrate error, dom not match from server. server: "<${dom.nodeName.toString()} />", client: "${getElementName(fiber)}"`);
log(fiber, "error", `hydrate error, dom not match from server. server: "<${dom.nodeName.toLowerCase()} />", client: "${getElementName(fiber)}"`);
}
return false;
}
Expand Down

0 comments on commit c08f64e

Please sign in to comment.