mirror of https://github.com/AMT-Cheif/drift.git
Only remove available implementations entries if they're available
This commit is contained in:
parent
b0946df3b7
commit
3e6cf51eea
|
@ -112,6 +112,9 @@ Note that Safari 16 has an [unfortunate bug](https://bugs.webkit.org/show_bug.cg
|
|||
preventing dedicated workers to be loaded from cache with these headers. However, shared and service workers
|
||||
are unaffected by this.
|
||||
|
||||
These headers are incompatible with [Google Auth
|
||||
Popups](https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid#:~:text=com%2Fgsi%2F%3B-,Cross%20Origin%20Opener%20Policy,popup%20window%20or%20similar%20bugs.).
|
||||
|
||||
### Setup in Dart
|
||||
|
||||
From a perspective of the Dart code used, drift on the web is similar to drift on other platforms.
|
||||
|
|
|
@ -93,11 +93,19 @@ class WasmDatabaseOpener {
|
|||
// format to avoid data loss (e.g. after a browser update that enables a
|
||||
// otherwise preferred storage implementation). In the future, we might want
|
||||
// to consider migrating between storage implementations as well.
|
||||
if (_existsInIndexedDb) {
|
||||
if (_existsInIndexedDb &&
|
||||
(availableImplementations
|
||||
.contains(WasmStorageImplementation.sharedIndexedDb) ||
|
||||
availableImplementations
|
||||
.contains(WasmStorageImplementation.unsafeIndexedDb))) {
|
||||
availableImplementations.removeWhere((element) =>
|
||||
element != WasmStorageImplementation.sharedIndexedDb &&
|
||||
element != WasmStorageImplementation.unsafeIndexedDb);
|
||||
} else if (_existsInOpfs) {
|
||||
} else if (_existsInOpfs &&
|
||||
(availableImplementations
|
||||
.contains(WasmStorageImplementation.opfsShared) ||
|
||||
availableImplementations
|
||||
.contains(WasmStorageImplementation.opfsLocks))) {
|
||||
availableImplementations.removeWhere((element) =>
|
||||
element != WasmStorageImplementation.opfsShared &&
|
||||
element != WasmStorageImplementation.opfsLocks);
|
||||
|
|
Loading…
Reference in New Issue