Skip to content

Commit

Permalink
fix: should only do unwrapStoreSplits for the object with constructo… (
Browse files Browse the repository at this point in the history
…#122)

* fix: should only do unwrapStoreSplits for the object with  constructor name

* fix: use isPlainObject instead constructor.name
  • Loading branch information
hunterliu1003 authored Jun 14, 2024
1 parent 1956c9b commit 02402f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/moduleActions/handleWritePerStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type {
} from '@magnetarjs/types'
import { isStoreSplit } from '@magnetarjs/utils'
import { mapGetOrSet } from 'getorset-anything'
import { isAnyObject, isFullArray, isFullString } from 'is-what'
import { isFullArray, isFullString, isPlainObject } from 'is-what'
import { mapObject } from 'map-anything'
import { getEventNameFnsMap } from '../helpers/eventHelpers.js'
import { getModifyPayloadFnsMap } from '../helpers/modifyPayload.js'
Expand Down Expand Up @@ -111,7 +111,7 @@ export function handleWritePerStore(
const unwrapStoreSplits = (payloadChunk: any, storeName: string): any => {
return isStoreSplit(payloadChunk)
? payloadChunk.storePayloadDic[storeName]
: isAnyObject(payloadChunk)
: isPlainObject(payloadChunk)
? mapObject(payloadChunk, (value) => unwrapStoreSplits(value, storeName))
: payloadChunk
}
Expand Down

0 comments on commit 02402f2

Please sign in to comment.