import { patchObject } from './hmr'
import { addSubscription, triggerSubscriptions } from './subscriptions'
-function innerPatch<T extends StateTree>(
+function mergeReactiveObjects<T extends StateTree>(
target: T,
patchToApply: DeepPartial<T>
): T {
!isRef(subPatch) &&
!isReactive(subPatch)
) {
- target[key] = innerPatch(targetValue, subPatch)
+ target[key] = mergeReactiveObjects(targetValue, subPatch)
} else {
// @ts-expect-error: subPatch is a valid value
target[key] = subPatch
events: debuggerEvents as DebuggerEvent[],
}
} else {
- innerPatch(pinia.state.value[$id], partialStateOrMutator)
+ mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator)
subscriptionMutation = {
type: MutationType.patchObject,
payload: partialStateOrMutator,
prop.value = initialState[key]
} else {
// probably a reactive object, lets recursively assign
- innerPatch(prop, initialState[key])
+ mergeReactiveObjects(prop, initialState[key])
}
}
// transfer the ref to the pinia state to keep everything in sync