effector / effector/farfetched
[API Design](Cache): Should ignore passed params into query for generating cache key if not expected by query
- Dominant language
- TypeScript
- Stars
- 221
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
Precondition: [docs](https://farfetched.pages.dev/recipes/cache.html#hashing-algorithm)
```
So, the key is a hash of the following data:
- SID of the Query
- params of the particular call of the Query
- current values of all external Stores that affect Query
To get short and unique key, we stringify all data, concatenate it and then hash it with SHA-1.
```
This design desigion does not take into account pattern within effector community with sample:
If EventPayload of target is void, user can pass data in any shape without any warning, thus it can be unintuitive, why they hit cache miss on, for example, page route params refetch
```
const getDataQuery = createQuery({
effect: () => Promise.resolve([])
})
sample({
clock: pageOpened // Event<{ params: { id: '1' }, query: {} }>
target: getDataQuery.start
})
sample({
clock: pageUpdated // Event<{ params: { id: '2'}, query: {} }>
target: getDataQuery.start
})
```
Contributor guide
Assessment
This issue has not been assessed yet.