-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: useActionData
returns raw Response
when using polyfilled fetch
#9722
Comments
useActionData
returns raw Response when using polyfilled fetch
useActionData
returns raw Response when using polyfilled fetchuseActionData
returns raw Response
when using polyfilled fetch
Hm, I'm not sure we want to alter the router code to support a non-spec-compliant Or potentially just call |
@brophdawg11 I think switching to a different polyfill makes sense in the general case. However, we haven't explicitly opted in to using fetch. It's being injected automatically by CRA. Thus, I'm assuming this will break any application created using CRA that have not yet ejected. Since there's no easy way of opting out (CRA only let's you control setupFilesAfterEnv through |
Affects me as well. I tried to add those polyfills from
|
@hovsater Have you checked with the CRA folks to see if they're open to using a spec-compliant fetch polyfill? That feels like the proper avenue here to me, I don't know that we want to propagate non-spec-compliant support into react-router due to a choice made by CRA. |
I have not. I'll do that as well to start a discussion on their side. 🙂 |
FYI: I've opened facebook/create-react-app#12913 over at facebook/create-react-app. |
Thanks @hovsater! I'll keep an eye over there as well! |
This issue has been automatically marked stale because we haven't received a response from the original author in a while 🙈. This automation helps keep the issue tracker clean from issues that are not actionable. Please reach out if you have more information for us or you think this issue shouldn't be closed! 🙂 If you don't do so within 7 days, this issue will be automatically closed. |
This issue has been automatically closed because we didn't hear anything from the original author after the previous notice. |
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 anduseActionData
returns the raw Response instead.Expected Behavior
I expect
useActionData
to always unwrap theResponse
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 rawResponse
is returned byuseActionData
.The text was updated successfully, but these errors were encountered: