-
Notifications
You must be signed in to change notification settings - Fork 138
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
fix: pass original fetch args along #1351
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: +6 B (0%) Total Size: 1.17 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change makes sense. I think we should be returning exactly the arguments we were given. Probably an oversight earlier on to have returned the constructed Request so worth fixing forward.
There's a risk we break this the other way e.g. customers have come to rely on the output of our fetch returning a Request
object. We won't really know that without shipping.
My suggestion would be to get this out there as a minor bump. At least then people are more likely to be able to track the version bump if it does cause an issue for them. Secondly, there's always the escape hatch of staying on the previous version until they've had a chance to fix their reliant code (which should be trivial either way).
The only other alternative I can think of is passing res = await originalFetch(req, init)
back but that feels less good. We'd be preserving current functionality at the expense of correctness. Given the points above it's probably just worth fixing everything now and dealing with any consequential issues that arise.
Our app went down tonight because of an issue with Posthog overwriting fetch in this file. Not sure that this exact change is the culprit, but the changes made to window.fetch in recorder.ts made RTKQuery unusable and left us with a very confusing FE bug that came down to the Posthog assets loading and breaking fetch. We solved it in the interim by using cross-fetch as the fetch function in RTK. |
oh yuck! so sorry @weilandia! will revert this change I've seen a few reports of similar and I'd be amazed if it was any of the other changes yesterday |
This reverts commit e2da050.
Thanks! |
When wrapping fetch we take a url, init pair and create a request object
When we pass on and call the original fetch method we pass the request object. this is technically equivalent to the original but not literally equivalent which can cause problems if there are further wrappers on fetch
see: #1326
We actively don't want to alter the fetch details so it should be 100% safe to use the original args when calling the original fetch 🤷