Skip to content

[Bug]: useActionData returns raw Response when using polyfilled fetch #9722

@hovsater

Description

@hovsater

What version of React Router are you using?

6.4.5

Steps to Reproduce

In a standard CRA environment, fetch is being polyfilled by fetch when running tests. Unfortunately, the polyfill does not implement .body, thus the new check introduced in #9690 fail and useActionData returns the raw Response instead.

Expected Behavior

I expect useActionData to always unwrap the Response body and give back the actual JSON.

Actual Behavior

Since the polyfill does not implement .body, typeof value.body !== "undefined" always fail and the response is not unwrapped as expected. Instead, the raw Response is returned by useActionData.

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