jakearchibald / idb

IndexedDB, but with promises
https://www.npmjs.com/package/idb
ISC License
6.22k stars 348 forks source link

Safari iOS/iPadOS 14.6 Bug: First Attempt at Opening indexedDB gets stuck #227

Open jakearchibald opened 3 years ago

jakearchibald commented 3 years ago

Same issue as https://github.com/jakearchibald/idb-keyval/issues/120.

I'm trying to get more details on this. If second-connection always works, I'll add it in. I'm not sure what to do if the second connection is still a race.

jakearchibald commented 3 years ago

Here's a little library that works around this bug https://www.npmjs.com/package/safari-14-idb-fix.

I haven't figured out how to integrate it here yet.

jakearchibald commented 3 years ago

The main problem here is:

import { openDB, unwrap } from 'idb';

const openPromise = openDB(...args);
const idbOpenRequest = unwrap(openPromise);

I can't introduce a 'wait' into openDB without breaking the unwrap case, since I won't have the real idbOpenRequest yet.

runofthemillgeek commented 3 years ago

The main problem here is:

import { openDB, unwrap } from 'idb';

const openPromise = openDB(...args);
const idbOpenRequest = unwrap(openPromise);

I can't introduce a 'wait' into openDB without breaking the unwrap case, since I won't have the real idbOpenRequest yet.

Could add an unwrapAsync to handle this scenario. Is unwrap commonly used by idb users? 🤔

jakearchibald commented 3 years ago

Seems sad to add a whole new API for a temporary Safari bug.

I suspect unwrap is rarely used, but I don't know.

runofthemillgeek commented 3 years ago

Seems sad to add a whole new API for a temporary Safari bug.

I agree with that 😞