Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix): resolve AsyncLocalStorage Illegal Invocation errors
- I (and apparently most mst-persist users) don't use localStorage, so this went undetected for a while until someone reported a bug - and I finally hit upon it myself when adding tests shortly after, which added a solid reproduction as well as a blocker on it - it made localStorage unusable as all of AsyncLocalStorage's calls would give Illegal Invocation errors - see https://stackoverflow.com/q/41126149/3431180 for more details on this error - using .call did not work, not on callWithPromise.call(window, ...) nor func.call(window, ...args) - similarly window.localStorage.func.bind(window) did not work - so instead used wrapper functions as an alternative that didn't feel too convoluted - using window.localStorage[funcKey] in callWithPromise did not quite feel right, wrapper functions felt better
- Loading branch information