Skip to content

Commit

Permalink
fix(hydration): swap client/server labels for hydration mismatch warn…
Browse files Browse the repository at this point in the history
…ings

this was swapped in #9098 but lost when merging #5953
  • Loading branch information
yyx990803 committed Dec 12, 2023
1 parent ef688ba commit f41fd86
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/runtime-core/src/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ export function createHydrationFunctions(
warn(
`Hydration text mismatch in`,
node.parentNode,
`\n - rendered on server: ${JSON.stringify(vnode.children)}` +
`\n - expected on client: ${JSON.stringify(
(node as Text).data
)}`
`\n - rendered on server: ${JSON.stringify(
(node as Text).data
)}` +
`\n - expected on client: ${JSON.stringify(vnode.children)}`
)
;(node as Text).data = vnode.children as string
}
Expand Down Expand Up @@ -431,8 +431,8 @@ export function createHydrationFunctions(
warn(
`Hydration text content mismatch on`,
el,
`\n - rendered on server: ${vnode.children as string}` +
`\n - expected on client: ${el.textContent}`
`\n - rendered on server: ${el.textContent}` +
`\n - expected on client: ${vnode.children as string}`
)
el.textContent = vnode.children as string
}
Expand Down Expand Up @@ -613,15 +613,15 @@ export function createHydrationFunctions(
hasMismatch = true
;(__DEV__ || __FEATURE_PROD_HYDRATION_MISMATCH_DETAILS__) &&
warn(
`Hydration node mismatch:\n- Client vnode:`,
vnode.type,
`\n- Server rendered DOM:`,
`Hydration node mismatch:\n- rendered on server:`,
node,
node.nodeType === DOMNodeTypes.TEXT
? `(text)`
: isComment(node) && node.data === '['
? `(start of fragment)`
: ``
: ``,
`\n- expected on client:`,
vnode.type
)
vnode.el = null

Expand Down

0 comments on commit f41fd86

Please sign in to comment.