Description
Bug report
Description / Observed Behavior
I made changes to data
returned from useSWR, to format the data. This updated the SWR cache with the formatted data, which later resulted in a different useSWR hook returning the formatted data, which is incorrect.
Expected Behavior
I would expect that any changes made to the data object be made locally only and not propagated to the SWR cache.
Repro Steps / Code Example
Additional Context
I don't think making changes directly to data
is great practice anyway, but it can be fairly easy to do so accidentally. In my case I had mistakenly expected a lodash function to return a copy of the data and not the data object itself. While I understand why this would make changes to data
locally, I was surprised to find this affected the cache as I would not expect changes outside of the fetcher function to make changes to the cache.