Open stx opened 1 year ago
At the moment, we store data in IndexedDB like this:
I suspect that Safari doesn't like Blob
s. IndexedDB should support storing Uint8List
s directly, but unfortunately the Dart SDK is doing a manual list copy when storing any List
in there. We can avoid this by calling the native method directly. I have done this on the avoid-storing-blobs
branch, could you try it out and see if that fixes the problem (if you have a way to reproduce this somewhat reliably?):
dependency_overrides:
drift:
git:
url: https://github.com/simolus3/drift.git
ref: avoid-storing-blobs
path: drift
But it's pretty weird that this happens occasionally. If blobs aren't supported, why doesn't it fail every time :confused:?
The reproduce the error try Safari with a private window. I think it is that Safari does not support blobs for some reason in Private Browsing.
Note Im using the old index db method of opening the database. Not sure what happens with the web worker.
final executor = LazyDatabase(() async {
return WebDatabase.withStorage(await DriftWebStorage.indexedDbIfSupported('database_name'));
});
Using Flutter Web (latest stable everything), we occasionally see this error and have no idea why, because we're not inserting URLs. Seen on Safari 16.1. Is this something that Drift is doing internally?