swr icon indicating copy to clipboard operation
swr copied to clipboard

Non isolated behavior in multiple `useSWRInfinite` with same URL

Open ddoice opened this issue 9 months ago • 1 comments

Bug report

Hey everyone, first of all, thank you for this great library. I'm using it on a website that requires infinite scroll for items with the same initial URL. Unfortunately, setSize changes the size for both instances, but I need them to be isolated.

Some of the views react to user actions and need to add/remove items, and this behavior should only occur in that specific view, not on all of them.

Image

Description / Observed Behavior

Can't use useSWRInfinite more than once with the same initial URL.

Expected Behavior

Be able to use it multiple times with the same initial URL, and for each instance to behave in isolation.

Repro Steps / Code Example

Example

Additional Context

SWR version 2.3.2

ddoice avatar Feb 19 '25 08:02 ddoice

Duplicated

ddoice avatar Feb 19 '25 12:02 ddoice