ymoon715 / rtk-query-msw

issue with MSW when using RTK-query
1 stars 0 forks source link

Question #1

Open albertofcasuso opened 1 year ago

albertofcasuso commented 1 year ago

Hi, just run into this exact same issue with RTK Query, MSW and Vitest. Have you found any solution?

ymoon715 commented 1 year ago

@albertofcasuso Some have suggested I clear the cache of all the rtk query after each test. Not sure if this will resolve it, and i have not tried yet. If it works for you, can you let me know? :D

albertofcasuso commented 1 year ago

I've tried that following this guide.

Testing rtk query

Where it uses this piece of code afterEach(()=> {store.dispatch(apiSlice.util.resetApiState()})

And did not do the trick for me. Still looking for something

UPDATE: I've opened this issue in rtk-query repo in case you'd like to take a look. It includes a public repo https://github.com/reduxjs/redux-toolkit/issues/3069

ymoon715 commented 1 year ago

@albertofcasuso Seems like thats the work around. did that solution workout for you?