Skip to content

useSWR calls with the same key in the same component yielding different data #463

Closed
@derindutz

Description

@derindutz

Bug report

Hi! First, I just wanted to say thank you for your work on this library 😊 It's been a ton of fun to use and has made both my development process and the product I'm working on faster.

Description / Observed Behavior

useSWR calls in the same component with the same key yield different data

Expected Behavior

I'd expect useSWR calls in the same component to yield the same data. I was using helper hooks and two helpers called useSWR with the same key. My code relied on both calls returning the same data. This led to a weird and unexpected bug that took multiple hours to figure out.

Repro Steps / Code Example

https://codesandbox.io/s/swr-test-9jcdz?file=/src/App.js

Additional Context

SWR version: 0.2.3

Thanks for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions