Skip to content

Possible inconsistency with isError and error when using keepPreviousData: true #1659

@tannerlinsley

Description

@tannerlinsley
  • Turn on keepPreviousData: true
  • Template using isError, not error, to detect an error state
  • Fire a query that resolves and displays normally
  • Fire a query that fails and introduces an error state
  • The isError state is false, but there is clearly an error present.

I think the desired effect is that if an error is encountered in the new/latest query, the status should not be success with the previous data, but error with the new query.

Codesandbox: https://codesandbox.io/s/optimistic-hooks-n5v12?file=/src/index.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions