Is the key cache global? How does it handle conflicts if it's used in multiple contexts?
Yes, the key cache is global across all useSWR calls.
How does it handle conflicts
Your cache keys shouldn't conflict, otherwise the cache isn't very useful. We've found that using the URL of the API you're calling to be good keys.
used in multiple contexts
If you have useSWR calls in multiple places that use the same key, the data is shared and updated in all contexts. This makes it easy to synchronize data between multiple pages that use the same data sources.
Yes, the key cache is global across all useSWR calls.
useSWR share states between multiple calls in same next.js page.
but, useSWR does NOT share states between multiple next.js pages,