Skip to content
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

feat(trpc): use fetch fn that directs to window.fetch #225

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

LoneRifle
Copy link
Contributor

Problem

By default, tRPC will retain its own reference to window.fetch on init. Any changes to or replacements of window.fetch would not be picked up by tRPC, which will affect eg, instrumentation by Datadog RUM.

Solution

Fix this by supplying our own fetch implementation that delegates to whatever is the current global fetch().

By default, tRPC will retain its own reference to window.fetch on init.
Any changes to or replacements of window.fetch would not be picked up
by tRPC, which will affect eg, instrumentation by Datadog RUM.

Fix this by supplying our own fetch implementation that delegates to
whatever is the current global `fetch()`.
@LoneRifle LoneRifle requested a review from karrui November 22, 2023 09:21
Copy link

vercel bot commented Nov 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
starter-kit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2023 9:22am

@karrui karrui merged commit 0f14b92 into main Nov 22, 2023
4 checks passed
@karrui karrui deleted the feat/trpc/current-fetch branch November 22, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants