MCPcopy Index your code
hub / github.com/TanStack/db / memoizedCreateChangeProxy

Function memoizedCreateChangeProxy

packages/db/src/proxy.ts:643–666  ·  view source on GitHub ↗
(
    innerTarget: TInner,
    innerParent?: {
      tracker: ChangeTracker<Record<string | symbol, unknown>>
      prop: string | symbol
    },
  )

Source from the content-addressed store, hash-verified

641 const changeProxyCache = new Map<object, object>()
642
643 function memoizedCreateChangeProxy<
644 TInner extends Record<string | symbol, any | undefined>,
645 >(
646 innerTarget: TInner,
647 innerParent?: {
648 tracker: ChangeTracker<Record<string | symbol, unknown>>
649 prop: string | symbol
650 },
651 ): {
652 proxy: TInner
653 getChanges: () => Record<string | symbol, any>
654 } {
655 debugLog(`Object ID:`, innerTarget.constructor.name)
656 if (changeProxyCache.has(innerTarget)) {
657 return changeProxyCache.get(innerTarget) as {
658 proxy: TInner
659 getChanges: () => Record<string | symbol, any>
660 }
661 } else {
662 const changeProxy = createChangeProxy(innerTarget, innerParent)
663 changeProxyCache.set(innerTarget, changeProxy)
664 return changeProxy
665 }
666 }
667 // Create a WeakMap to cache proxies for nested objects
668 // This prevents creating multiple proxies for the same object
669 // and handles circular references

Callers 3

getProxiedElementFunction · 0.85
nextFunction · 0.85
getFunction · 0.85

Calls 5

debugLogFunction · 0.85
createChangeProxyFunction · 0.85
hasMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…