Skip to content

Response is not defined in Node #265

Open
@thure

Description

@thure

Describe the bug
useFetch crashes the SSR server if the code makes any call to the getter for a response. The getter uses instanceof Response, expecting Reponse on the global namespace, which is undefined in Node.

To Reproduce
Steps to reproduce the behavior:

  1. Create a React component that uses useFetch
  2. Add the following to its render function:
const {response} = useFetch('https://localhost:4001')
const responseStatus = response.status
  1. Render using Node

Expected behavior
The getter for responses should return the right value whether on the server or on the client.

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