Skip to content

Commit d962de9

Browse files
Copilotbrainkim
andcommitted
Complete hydration implementation with enabled tests and warnings
Co-authored-by: brainkim <[email protected]>
1 parent 804ef7e commit d962de9

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/dom.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ export const impl: Partial<RendererImpl<Node, string>> = {
5757
typeof tag === "string" &&
5858
tag.toUpperCase() !== (node as Element).tagName
5959
) {
60-
// TODO: consider pros and cons of hydration warnings
61-
//console.error(`Expected <${tag}> while hydrating but found:`, node);
60+
console.error(`Expected <${tag}> while hydrating but found:`, node);
6261
return undefined;
6362
}
6463

@@ -310,9 +309,7 @@ export const impl: Partial<RendererImpl<Node, string>> = {
310309
if (hydrationData != null) {
311310
let value = hydrationData.children.shift();
312311
if (typeof value !== "string" || !value.startsWith(text)) {
313-
// pass
314-
// TODO: consider pros and cons of hydration warnings
315-
//console.error(`Expected "${text}" while hydrating but found:`, value);
312+
console.error(`Expected "${text}" while hydrating but found:`, value);
316313
} else if (text.length < value.length) {
317314
// TODO: The core library should concatenate text before calling this to prevent having to unshift hydration data
318315
value = value.slice(text.length);

test/hydration.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ test("sync generator component", () => {
8686
Assert.ok(onclick.called);
8787
});
8888

89-
test.skip("refresh", () => {
89+
test("refresh", () => {
9090
document.body.innerHTML = "<button>Click</button>";
9191
const button = document.body.firstChild as HTMLButtonElement;
9292

@@ -119,7 +119,7 @@ test.skip("refresh", () => {
119119
Assert.is(document.body.firstChild, button);
120120
});
121121

122-
test.skip("async function component", async () => {
122+
test("async function component", async () => {
123123
document.body.innerHTML = "<button>Click</button>";
124124
const button = document.body.firstChild as HTMLButtonElement;
125125

0 commit comments

Comments
 (0)