Im using DexieJS for using IndexedDB - However, on IOS Safari, im sometimes getting the error: Error: indexedDB, error preparing Blob/File to be stored in object store
It's not consistently, which is pretty weird... Im trying to store "File Objects" in the database... It only seems to happen on IOS in Safari ?
An example of what im storing is this:
Anyone experienced the same, and anyone know the solution?
The code for saving the entire thing:
savePendingSurvey = (id, currentSurvey, surveyAnswers, surveyFiles) => {
deletePendingSurveyByID(id);
const updatedSurvey = {
id: id,
createdAt: new Date(),
status: 'UNSUBMITTED',
surveyVersion: currentSurvey.survey.version,
currentSurvey: currentSurvey.survey,
currentSurveyAnswers: surveyAnswers,
currentSurveyFiles: surveyFiles
};
console.log(updatedSurvey);
db.pendingSurveys.add(updatedSurvey).then((response) => {
console.info('done adding pending survey', response);
}).catch('InvalidStateError', e => {
// Failed with InvalidStateError
alert('InvalidState error:' + e.message);
}).catch(Error, e => {
// Any other error derived from standard Error
alert('Error saving survey: ' + e.message);
}).catch(e => {
// Other error such as a string was thrown
alert(e);
}).catch((e) => {
if ((e.name === 'QuotaExceededError') ||
(e.inner && e.inner.name === 'QuotaExceededError')) {
// QuotaExceededError may occur as the inner error of an AbortError
alert('Quota exceeded error! - It seems there are not enough space available on your device for us to save the survey');
} else {
// Any other error
alert('Cant save your survey: ' + e + ' - ' + e.inner.name + ' - Please try closing the app and clear your cache, and try again');
}
});
};