Skip to content

Non isolated behavior in multiple useSWRInfinite with same URL #4098

Open
@ddoice

Description

@ddoice

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions