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

Function markChanged

packages/db/src/proxy.ts:690–715  ·  view source on GitHub ↗
(state: ChangeTracker<object>)

Source from the content-addressed store, hash-verified

688 // Mark this object and all its ancestors as modified
689 // Also propagate the actual changes up the chain
690 function markChanged(state: ChangeTracker<object>) {
691 if (!state.modified) {
692 state.modified = true
693 }
694
695 // Propagate the change up the parent chain
696 if (state.parent) {
697 debugLog(`propagating change to parent`)
698
699 // Check if this is a special Map parent with updateMap function
700 if (`updateMap` in state.parent) {
701 // Use the special updateMap function for Maps
702 state.parent.updateMap(state.copy_)
703 } else if (`updateSet` in state.parent) {
704 // Use the special updateSet function for Sets
705 state.parent.updateSet(state.copy_)
706 } else {
707 // Update parent's copy with this object's current state
708 state.parent.tracker.copy_[state.parent.prop] = state.copy_
709 state.parent.tracker.assigned_[state.parent.prop] = true
710 }
711
712 // Mark parent as changed
713 markChanged(state.parent.tracker)
714 }
715 }
716
717 // Check if all properties in the current state have reverted to original values
718 function checkIfReverted(

Callers 5

wrappedCallbackFunction · 0.85
setFunction · 0.85
definePropertyFunction · 0.85
deletePropertyFunction · 0.85

Calls 1

debugLogFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…