From c08f64e4e9ac8bee525e37562cdcaed48c2e80ef Mon Sep 17 00:00:00 2001 From: MrWangJustToDo <2711470541@qq.com> Date: Thu, 14 Dec 2023 13:54:56 +0800 Subject: [PATCH] fix hydrate element type error --- .../myreact-dom/src/client/api/create/getHydrateDom.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/myreact-dom/src/client/api/create/getHydrateDom.ts b/packages/myreact-dom/src/client/api/create/getHydrateDom.ts index 6b291e09..c0c96e43 100644 --- a/packages/myreact-dom/src/client/api/create/getHydrateDom.ts +++ b/packages/myreact-dom/src/client/api/create/getHydrateDom.ts @@ -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; } @@ -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; }