effector / effector/farfetched
Expose / Provide Event to mutate cached data
Open
discussion
scope:core
- Dominant language
- TypeScript
- Stars
- 221
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
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:
```ts
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
```
Contributor guide
Assessment
This issue has not been assessed yet.