Solid-js router 0.10.x cache invalidation

Hi, I started migrating an app from solidjs router 0.9.x and 0.10.x. The new caching and preload features are nice, but I'm having some trouble with testing. In my test setup I intercept API requests and inject different stubs for different tests. Since the tests run fast, the new solid router cache function does not invalidate the cache from one test to the next, causing some tests to get API responses made for previous tests when making the same API requests. I looked at the source code of cache and there seems to be no way to invalidate the entire cache. I saw that there is a cache.set function there but it seems it can't be used for invalidating individual caches. Are there other tricks I can use to achieve this behavior? I really don't want to change components' code to fetch without caching for tests, so it would be interesting to have some sort of cache.clear to invalidate the entire cache for testing purposes.
1 Reply
ryansolid
ryansolid6mo ago
Good suggestion. I wasn't thinking about testing. Lets do something about that.