feat: use the middleware instead of injecting a cache#39
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/koba04/swr-devtools/GXQ6dicETieXm4eki9xQ713bJS7h |
|
Thanks for working on this! Here are my thoughts:
That is indeed a problem. We can probably monitor data updates via a listener or something else, but we can't use
|
|
Thank you for your comments!
Yeah, that's right. I think it seems to be ok. But I'm a little worried about it because I often see that the behavior of React makes developers confused. I think
That might be useful, but is there any way to know whether |
I think the most "correct" way of doing so is by getting the |
This approach has some problems, so I won't take this approach. But I created a PR to put my works.
SWR's middleware allows us to a hook for
useSWRhooks, which seems to be a good place for SWRDevtools.But this has the following problems.
useSWRare monitored byswrto optimize re-rendering, which is implemented by getters. So if we get the data for SWRDevtools, it is marked as "used" and causes extra re-rendering. refs feat: record SWR data with useDebugValue #37 (comment).keystrings in middlewares. We can useunstable_serialize, but how should I handleuseSWRInfinite?