diff --git a/CHANGES.md b/CHANGES.md index 0b6c626..8ae3188 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changelog +## 1.0.0 (Unreleased) + +- Fix a race condition when setting a localForage driver + ## 0.0.8 (2023-02-14) - Use the released version of `@converse/localforage-getitems` diff --git a/src/storage.js b/src/storage.js index 707092b..aa26b9f 100644 --- a/src/storage.js +++ b/src/storage.js @@ -42,11 +42,11 @@ class Storage { async initStore (type, batchedWrites) { if (type === 'session') { - localForage.setDriver(sessionStorageWrapper._driver); + await localForage.setDriver(sessionStorageWrapper._driver); } else if (type === 'local') { await localForage.config({'driver': localForage.LOCALSTORAGE}); } else if (type === 'in_memory') { - localForage.config({'driver': IN_MEMORY}); + await localForage.config({'driver': IN_MEMORY}); } else if (type !== 'indexed') { throw new Error("Skeletor.storage: No storage type was specified"); }