(state: ChangeTracker<object>)
| 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( |
no test coverage detected
searching dependent graphs…