Describe the bug
When using useFetch from Hyper fetch v8 in multiple components rendered in a list, identical requests are executed multiple times instead of being deduplicated through cache sharing.
This leads to unnecessary duplicate API calls even when the fetcher and parameters are identical.
To Reproduce
Steps to reproduce the behavior:
- Create two components using the same
useFetch hook
- Render them multiple times using a list (e.g.
.map)
- Mount both components simultaneously in the same render tree
- Observe network / logs from the fetcher
- See that the same request is executed multiple times instead of being cached
function ComponentA() {
const { data } = useFetch(getData);
return <div>A</div>;
}
function ComponentB() {
const { data } = useFetch(getData);
return <div>B</div>;
}
export default function App() {
const items = Array.from(Array(22).keys());
return (
<>
{items.map((_, index) => (
<Fragment key={index}>
<ComponentA />
<ComponentB />
</Fragment>
))}
</>
);
}
Expected behavior
- Only one network request should be executed
- All hook instances should share the same cached result
- No duplicate API calls should occur for identical requests
Screenshots
Not applicable (behavior observable via network tab or console logs)
Smartphone (please complete the following information):
- Device: Pixel 9
- OS: android
Additional context
- Issue occurs when multiple components using the same
useFetch hook are rendered in a list
- Each component independently triggers the same request
- Suggests cache deduplication is not shared across hook instances or mounts
- Behavior is consistent even when rendering identical fetchers in the same render cycle
- Likely related to cache key resolution or request deduplication timing in v8
Describe the bug
When using
useFetchfrom Hyper fetch v8 in multiple components rendered in a list, identical requests are executed multiple times instead of being deduplicated through cache sharing.This leads to unnecessary duplicate API calls even when the fetcher and parameters are identical.
To Reproduce
Steps to reproduce the behavior:
useFetchhook.map)Expected behavior
Screenshots
Not applicable (behavior observable via network tab or console logs)
Smartphone (please complete the following information):
Additional context
useFetchhook are rendered in a list