@oneblink/apps
Advanced tools
Comparing version 12.0.1-beta.2 to 12.0.1-beta.3
@@ -257,7 +257,4 @@ import { v4 as uuidv4 } from 'uuid'; | ||
async function tryGetFormSubmissionDrafts(formsAppId, abortSignal) { | ||
const localDraftsStorage = await getLocalDrafts(); | ||
try { | ||
localDraftsStorage.syncedFormSubmissionDrafts = | ||
await getFormSubmissionDrafts(formsAppId, abortSignal); | ||
await setAndBroadcastDrafts(localDraftsStorage); | ||
return await getFormSubmissionDrafts(formsAppId, abortSignal); | ||
} | ||
@@ -269,3 +266,2 @@ catch (error) { | ||
} | ||
return localDraftsStorage.syncedFormSubmissionDrafts; | ||
} | ||
@@ -291,3 +287,11 @@ /** | ||
} | ||
const formSubmissionDrafts = await tryGetFormSubmissionDrafts(formsAppId, abortSignal); | ||
let formSubmissionDrafts = await tryGetFormSubmissionDrafts(formsAppId, abortSignal); | ||
const localDraftsStorage = await getLocalDrafts(); | ||
if (formSubmissionDrafts) { | ||
localDraftsStorage.syncedFormSubmissionDrafts = formSubmissionDrafts; | ||
await setAndBroadcastDrafts(localDraftsStorage); | ||
} | ||
else { | ||
formSubmissionDrafts = localDraftsStorage.syncedFormSubmissionDrafts; | ||
} | ||
const formSubmissionDraft = formSubmissionDrafts.find(({ id }) => id === formSubmissionDraftId); | ||
@@ -409,3 +413,2 @@ if (!formSubmissionDraft) { | ||
newDeletedFormSubmissionDrafts; | ||
await setAndBroadcastDrafts(localDraftsStorage); | ||
} | ||
@@ -431,4 +434,6 @@ if (localDraftsStorage.unsyncedDraftSubmissions.length) { | ||
} | ||
localDraftsStorage.syncedFormSubmissionDrafts = | ||
await getFormSubmissionDrafts(formsAppId, abortSignal); | ||
const formSubmissionDrafts = await tryGetFormSubmissionDrafts(formsAppId, abortSignal); | ||
if (formSubmissionDrafts) { | ||
localDraftsStorage.syncedFormSubmissionDrafts = formSubmissionDrafts; | ||
} | ||
await setAndBroadcastDrafts(localDraftsStorage); | ||
@@ -435,0 +440,0 @@ if (localDraftsStorage.syncedFormSubmissionDrafts.length) { |
@@ -33,3 +33,11 @@ import utilsService from './utils'; | ||
try { | ||
const formSubmissionDraftVersion = await uploadDraftData(draftSubmission, onProgress, abortSignal); | ||
return await uploadDraftData(draftSubmission, onProgress, abortSignal); | ||
} | ||
catch (error) { | ||
// Ignoring all errors here as we don't want draft submission data | ||
// being saved to the cloud to prevent drafts from being saved on the device | ||
console.warn('Could not upload Draft Data as JSON', error); | ||
Sentry.captureException(error); | ||
} | ||
finally { | ||
if (typeof autoSaveKey === 'string') { | ||
@@ -44,10 +52,3 @@ try { | ||
} | ||
return formSubmissionDraftVersion; | ||
} | ||
catch (error) { | ||
// Ignoring all errors here as we don't want draft submission data | ||
// being saved to the cloud to prevent drafts from being saved on the device | ||
console.warn('Could not upload Draft Data as JSON', error); | ||
Sentry.captureException(error); | ||
} | ||
} | ||
@@ -54,0 +55,0 @@ export async function deleteDraftData(formSubmissionDraftId, abortSignal) { |
{ | ||
"name": "@oneblink/apps", | ||
"description": "Helper functions for OneBlink apps in JavaScript.", | ||
"version": "12.0.1-beta.2", | ||
"version": "12.0.1-beta.3", | ||
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)", | ||
@@ -6,0 +6,0 @@ "bugs": { |
Sorry, the diff of this file is not supported yet
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
1094044
12558