Skip to content

Silent error in getKey within useSWRInfinite #2102

@onlyanegg

Description

@onlyanegg

Bug report

Description / Observed Behavior

useSWRInfinite hides errors within getKey (at least on the first page load). The error in getKey seems to cause the fetcher not to run. Because the error is hidden, it's difficult to debug.

Expected Behavior

I expect it to raise or display the error

Repro Steps / Code Example

import useSWRInfinite from "swr/infinite";

useSWRInfinite(                    
  () => {                          
    throw new Error();             
  },                               
  () => fetch("http://example.com")
);                                 

Additional Context

[email protected]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions