From e109c40d28b4ff1117b69fdd4911a9cc646fbb84 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Sat, 12 Oct 2024 10:58:39 +0200 Subject: [PATCH] Extract into separate func --- benches/src/02_replace1k.html | 2 +- src/diff/index.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/benches/src/02_replace1k.html b/benches/src/02_replace1k.html index ee597fa0fba..e6b6270b6eb 100644 --- a/benches/src/02_replace1k.html +++ b/benches/src/02_replace1k.html @@ -35,7 +35,7 @@ const elementSelector = 'tr:first-child > td:first-child'; // MUST BE KEPT IN SYNC WITH WARMUP COUNT IN benches/scripts/config.js - const WARMUP_COUNT = 25; + const WARMUP_COUNT = 5; for (let i = 0; i < WARMUP_COUNT; i++) { markRunStart(`warmup-${i}`); run(); diff --git a/src/diff/index.js b/src/diff/index.js index ced82b0647f..48787cb78ba 100644 --- a/src/diff/index.js +++ b/src/diff/index.js @@ -509,12 +509,10 @@ function diffElementNodes( } // @ts-expect-error - dom.textContent = newChildren; + dom.textContent = text; } } else { if (oldHtml) dom.innerHTML = ''; - // Previous render was a single text child. New children are not so let's - // unmount the previous text child if (typeof oldProps.children === 'string') { dom.removeChild(dom.firstChild); }