farfetched
farfetched copied to clipboard
Expose / Provide Event to mutate cached data
It would be great if the cache method could return an event with wich it would be possible to set cache data directly. This should work the same way how tanStackQuery.setQueryData works.
For Example:
const customerQuery = createQuery(...)
const { setCacheData } = cache(customerQuery, ...)
customerQuery.$data // { firstname: 'John', lastname: 'Doe' }
setCacheData({ firstname: 'John', lastname: 'Malkovich' })
customerQuery.$data // { firstname: 'John', lastname: 'Malkovich' } <-- $data reflects updated cache