replace immediate with queueMicrotask#8849
Conversation
This PR unifies pouchdb-utils/src/nextTick and pouchdb-utils/src/nextTick-browser, also it reduces the callstack of pouchdb-utils/src/nextTick.
|
IMO: ready to merge. |
immediate dependencyimmediate with queueMicrotask
|
Are you OK with this change @garethbowen? |
|
Honestly I'm a little reluctant. I think it raises the bar on browser support above where it currently is which always gives me pause. Otherwise as far as I can tell it's better in every way. How do you feel about keeping the next tick files around and updating the browser one to use queue microtask but falling back to a polyfill if it doesn't exist? eg: Alternatively if you can show Pouch already doesn't support Chrome 71 then it's fine as is... |
The Node docs specifies: nextTick, promise, and microTask queues are executed, in this order, at the end of each event loop and they seem to be equally optimized.
Ok, done with the newest commit (pass ✅ at first try 🎉)
Nothing more advanced than async/await (available since Chrome v55). TBH I don't feel comfortable supporting (or enable people to keep) unmaintained versions of Chrome, 'cause PouchDB enables the execution of arbitrary code (views map & reduce functions) and the list of Chrome CVE's show some serious problems within the last years. |
I agree in general, but if we drop support for browsers then we should probably bump the major version to make it clear, and notify everyone. We should definitely decide what our policy is and document that somewhere when we publish the next major version. Thanks for taking the time to make this backwards compatible for now! |
|
@SourceR85 Merged. Does this mean we can close #8816 and linked issues? Have you tested that this solves the Vite and Nuxt issues? |
Thank you
I don't see problems with Vite.js. At least the Vite case, I can say: it is battle-tested and will be fine. |
This PR unifies pouchdb-utils/src/nextTick and pouchdb-utils/src/nextTick-browser by replacing the dependency on
immediateand node-specificprocess.nextTickwith standardised queueMicrotask-API.Since the
queueMicrotask-API has been standardized and established (see compatibility list at mdn), theimmediatepackage is obsolete.As mentioned in #8816 (comment)