@oneblink/apps
Advanced tools
Comparing version 12.0.0-beta.9 to 12.0.0-beta.10
@@ -452,2 +452,17 @@ import { v4 as uuidv4 } from 'uuid'; | ||
let localDraftsStorage = await getLocalDrafts(); | ||
console.log('Removing local draft data for deleted drafts', localDraftsStorage.deletedFormSubmissionDrafts); | ||
if (localDraftsStorage.deletedFormSubmissionDrafts.length) { | ||
const newDeletedFormSubmissionDrafts = []; | ||
for (const formSubmissionDraft of localDraftsStorage.deletedFormSubmissionDrafts) { | ||
const { hasDeletedRemoteDraft } = await deleteDraftData(formSubmissionDraft.id, abortSignal); | ||
if (!hasDeletedRemoteDraft) { | ||
newDeletedFormSubmissionDrafts.push(formSubmissionDraft); | ||
} | ||
} | ||
// Get local drafts again to ensure nothing has happened while processing | ||
localDraftsStorage = await getLocalDrafts(); | ||
localDraftsStorage.deletedFormSubmissionDrafts = | ||
newDeletedFormSubmissionDrafts; | ||
await setDrafts(localDraftsStorage); | ||
} | ||
localDraftsStorage.syncedFormSubmissionDrafts = | ||
@@ -464,3 +479,3 @@ await getFormSubmissionDrafts(formsAppId, abortSignal); | ||
} | ||
console.log(`Attempting to upload ${localDraftsStorage.unsyncedDraftSubmissions.length} local unsycned drafts(s).`); | ||
console.log(`Attempting to upload ${localDraftsStorage.unsyncedDraftSubmissions.length} local unsynced drafts(s).`); | ||
if (localDraftsStorage.unsyncedDraftSubmissions.length) { | ||
@@ -485,17 +500,2 @@ const newUnsyncedDraftSubmissions = []; | ||
} | ||
console.log('Removing local draft data for deleted drafts', localDraftsStorage.deletedFormSubmissionDrafts); | ||
if (localDraftsStorage.deletedFormSubmissionDrafts.length) { | ||
const newDeletedFormSubmissionDrafts = []; | ||
for (const formSubmissionDraft of localDraftsStorage.deletedFormSubmissionDrafts) { | ||
const { hasDeletedRemoteDraft } = await deleteDraftData(formSubmissionDraft.id, abortSignal); | ||
if (!hasDeletedRemoteDraft) { | ||
newDeletedFormSubmissionDrafts.push(formSubmissionDraft); | ||
} | ||
} | ||
// Get local drafts again to ensure nothing has happened while processing | ||
localDraftsStorage = await getLocalDrafts(); | ||
localDraftsStorage.deletedFormSubmissionDrafts = | ||
newDeletedFormSubmissionDrafts; | ||
await setDrafts(localDraftsStorage); | ||
} | ||
console.log('Finished syncing drafts.'); | ||
@@ -502,0 +502,0 @@ _isSyncingDrafts = false; |
{ | ||
"name": "@oneblink/apps", | ||
"description": "Helper functions for OneBlink apps in JavaScript.", | ||
"version": "12.0.0-beta.9", | ||
"version": "12.0.0-beta.10", | ||
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)", | ||
@@ -6,0 +6,0 @@ "bugs": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1098007