From 4ecc343203070edd13b1c05886a1356df590b15b Mon Sep 17 00:00:00 2001 From: Simon He <57086651+Simon-He95@users.noreply.github.com> Date: Tue, 9 Jul 2024 15:48:34 +0800 Subject: [PATCH] refactor: set map condition branch (#2710) --- packages/pinia/src/store.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/pinia/src/store.ts b/packages/pinia/src/store.ts index afe5b202..2ff355b8 100644 --- a/packages/pinia/src/store.ts +++ b/packages/pinia/src/store.ts @@ -62,9 +62,8 @@ function mergeReactiveObjects< // Handle Map instances if (target instanceof Map && patchToApply instanceof Map) { patchToApply.forEach((value, key) => target.set(key, value)) - } - // Handle Set instances - if (target instanceof Set && patchToApply instanceof Set) { + } else if (target instanceof Set && patchToApply instanceof Set) { + // Handle Set instances patchToApply.forEach(target.add, target) } -- 2.47.3