-
|
Hi,
Problem: It seems to happen randomly, even on simple reads, when another tab is also active. My assumption is that this is caused by both tabs trying to access the same IndexedDB-backed database concurrently. Questions:
Thanks for the awesome work on Drift — would love some guidance on how to handle this scenario properly. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
This is not the expected behavior. Is this on Chrome Android or another platform? Typically for Chrome we'd use a shared worker to host the database, which should avoid issues with multiple tabs because it's all serialized through Chrome. If you're using
It's easier to give guidance with that information available, since it points at the potential failure. |
Beta Was this translation helpful? Give feedback.
Hi, thanks for the guidance.
I added a DriftWebOptions with an onResult callback and got this in Chrome on Windows:
Using WasmStorageImplementation.sharedIndexedDb due to unsupported browser features: {MissingBrowserFeature.dedicatedWorkersInSharedWorkers, MissingBrowserFeature.sharedArrayBuffers}Based on that, the issue was that Chrome disabled SharedArrayBuffer because my app wasn’t served with the required cross-origin isolation headers.
The fix was to add these headers in my Nginx config:
After that, …