Skip to content

Commit 2f882a6

Browse files
committed
Fix: Prevent input value leakage by generating unique keys for PartialComp [2.0 bug] different/incorrect behaviour due to bump fresh@1.7.3 up to @fresh/core@^2.0.0-alpha.29 #2850
1 parent 7aec5a2 commit 2f882a6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/runtime/client/partials.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,11 @@ function revivePartials(
457457
sib as Comment,
458458
);
459459

460+
// Always generate a unique key for PartialComp to avoid vnode reuse when switching partials, which fixes input value leakage issues.
461+
const uniqueKey = (partialKey !== "" ? partialKey : "partial") + "-" +
462+
Date.now();
460463
const root = h(PartialComp, {
461-
key: partialKey !== "" ? partialKey : undefined,
464+
key: uniqueKey,
462465
name: partialName,
463466
mode: partialMode,
464467
children: null,

0 commit comments

Comments
 (0)