MCPcopy Create free account
hub / github.com/facebook/Rapid / clearBackup

Method clearBackup

modules/core/EditSystem.js:1235–1248  ·  view source on GitHub ↗

* clearBackup * Remove any backup stored in localStorage. * This happens when: * - The user chooses to "Discard my changes" from the restore screen * - The user switches sources with the source switcher * - A changeset is inflight, we remove it to prevent the user from restoring dupli

()

Source from the content-addressed store, hash-verified

1233 * - A changeset is inflight, we remove it to prevent the user from restoring duplicate edits
1234 */
1235 clearBackup() {
1236 this._canRestoreBackup = false;
1237 this.deferredBackup.cancel();
1238
1239 if (!this._mutex.locked()) return; // another browser tab owns the history
1240
1241 const storage = this.context.systems.storage;
1242 storage.removeItem(this._backupKey());
1243
1244 // clear the changeset metadata associated with the saved history
1245 storage.removeItem('comment');
1246 storage.removeItem('hashtags');
1247 storage.removeItem('source');
1248 }
1249
1250
1251 /**

Callers 3

uploadChangesetMethod · 0.80
toggleMethod · 0.80
uiRestoreFunction · 0.80

Calls 3

_backupKeyMethod · 0.95
lockedMethod · 0.80
removeItemMethod · 0.45

Tested by

no test coverage detected