From: Simon He <57086651+Simon-He95@users.noreply.github.com> Date: Tue, 9 Jul 2024 07:48:34 +0000 (+0800) Subject: refactor: set map condition branch (#2710) X-Git-Tag: @pinia/nuxt@0.5.2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ecc343203070edd13b1c05886a1356df590b15b;p=thirdparty%2Fvuejs%2Fpinia.git refactor: set map condition branch (#2710) --- 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) }