MCPcopy
hub / github.com/Automattic/mongoose / restoreUnsavedState

Function restoreUnsavedState

lib/model.js:568–584  ·  view source on GitHub ↗
(doc, unsavedDirty, unsavedDefaultPaths)

Source from the content-addressed store, hash-verified

566 */
567
568function restoreUnsavedState(doc, unsavedDirty, unsavedDefaultPaths) {
569 if (unsavedDirty == null) {
570 return;
571 }
572
573 for (const dirty of unsavedDirty) {
574 doc.$__.activePaths.modify(dirty.path);
575 if (dirty.value?.[arrayAtomicsBackupSymbol]) {
576 dirty.value[arrayAtomicsSymbol] = dirty.value[arrayAtomicsBackupSymbol];
577 dirty.value[arrayAtomicsBackupSymbol] = null;
578 }
579 }
580
581 for (const path of unsavedDefaultPaths) {
582 doc.$__.activePaths.default(path);
583 }
584}
585
586/*!
587 * ignore

Callers 1

model.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…