effector / effector/farfetched

Expose / Provide Event to mutate cached data

Open
#508 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.