Skip to content

TypeError: Cannot destructure property 'error' of 'results[(results.length - 1)]' as it is undefined. [Suspense] #554

Closed
@ntucker

Description

@ntucker
  • react-hooks-testing-library version: 5.0.2
  • react version: 17.0.1
  • react-dom version (if applicable): 17.0.1
  • react-test-renderer version (if applicable):17.0.1
  • node version:14.13.1
  • npm (or yarn) version:1.22.5

Relevant code or config:

expect(result.error).toBe(null);

What you did:

Directly after the renderHooks() line with a function that throws a Promise

What happened:

Reproduction:

result.error just after a hook that suspends (don't await the resolution of suspense).

result.current was fixed in dc21e59 but result.error was not.

Problem description:

Suspense is the most important use of this library

Suggested solution:

Do the thing in dc21e59 but apply to all members

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions