You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've just started trying out MSW recently, and it's mostly going great. But I do have one small annoyance. In one of my tests I'm checking for calls to a local storage mock, and I am seeing roughly 90 checks from MSW for MSW_COOKIE_STORE_test. I wonder if instead of checking for supportsLocalStorage() in every hydrate() and persist() (which I guess can happen a lot?), maybe it can be done once (maybe in the constructor) and the result cached? I'm not very familiar with the architecture here so maybe that's a bad suggestion, but I thought I'd at least bring it up.
Thanks!
The text was updated successfully, but these errors were encountered:
Hi, @IanVS 👋 I think that's a fantastic idea. I'm not sure why we are checking it on each hydrate/persist. The availability of the storage isn't expected to change between those calls.
We are better off checking it on the root of store.ts (once you import the module) as the store availability is dictated by the environment where you import the module from.
Please, would you be interested in opening a pull request to help us fix this?
Hi, I've just started trying out MSW recently, and it's mostly going great. But I do have one small annoyance. In one of my tests I'm checking for calls to a local storage mock, and I am seeing roughly 90 checks from MSW for
MSW_COOKIE_STORE_test
. I wonder if instead of checking forsupportsLocalStorage()
in everyhydrate()
andpersist()
(which I guess can happen a lot?), maybe it can be done once (maybe in the constructor) and the result cached? I'm not very familiar with the architecture here so maybe that's a bad suggestion, but I thought I'd at least bring it up.Thanks!
The text was updated successfully, but these errors were encountered: