Skip to content

feat(subscriptions): connection state - #6084

Merged
KATT merged 109 commits into
nextfrom
10-07-sub-state
Oct 20, 2024
Merged

KATT merged 109 commits into
nextfrom
10-07-sub-state

Conversation

@KATT

@KATT KATT commented Oct 7, 2024 •

Copy link
Copy Markdown
Member

🎯 Changes

  • Allow for subscribing to connection state of WebSockets / EventSource.
  • Adds retryLink - could potentially be extended to support keeping track of resuming correct lastEventId later
  • Removes experimental_shouldRecreateOnError
  • Adds ponyfill-ability to httpSubscriptionLink
  • Refactor resolveResponse so individually batched messages return error created in context e.g. the httpSubscriptionLink will now serialize errors thrown in the context

📚 Docs

✅ Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

@railway-app

railway-app Bot commented Oct 7, 2024 •

Copy link
Copy Markdown

🚅 Previously deployed to Railway in the trpc-sse-and-websockets project. Environment has been deleted.

@vercel

vercel Bot commented Oct 7, 2024 •

Copy link
Copy Markdown

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

Name Status Preview Comments Updated (UTC)
next-prisma-starter ✅ Ready (Inspect) Visit Preview Oct 20, 2024 7:18pm
og-image ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 20, 2024 7:18pm
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 20, 2024 7:18pm

@KATT

KATT commented Oct 20, 2024

Copy link
Copy Markdown
Member Author

cc @Nick-Lucas @BeBoRE this is ready for review 🙃

Comment thread www/docs/client/links/retryLink.md Outdated
`retryLink` is a link that allows you to retry failed operations in your tRPC client. It provides a customizable way to handle transient errors, such as network failures or server errors, by automatically retrying the failed requests based on specified conditions.

:::tip
If you use `@trpc/react-query` you don't generally need this as it's built into `@tanstack/react-query`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be ambiguous, not everything in @trpc/react-query is built on react query and have it baked in, useSubscription being the subject of this PR. Not sure how to add clarity without getting wordy though

@Nick-Lucas

Copy link
Copy Markdown
Contributor

cc @Nick-Lucas @BeBoRE this is ready for review 🙃

@KATT have looked it over, not gotten into the nitty gritty of internals but the public API and docs look great overall. Few suggestions but I'll approve now

KATT added 6 commits October 20, 2024 08:06
# Conflicts:
#	packages/server/src/unstable-core-do-not-import/http/resolveResponse.ts
#	packages/server/src/unstable-core-do-not-import/stream/sse.test.ts
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

This branch was successfully deployed

5 active deployments
Preview – www — 9d1bf435 Deployed Oct 20, 2024 by vercel[bot]
Preview – next-prisma-starter — 9d1bf435 Deployed Oct 20, 2024 by vercel[bot]
Preview – trpc-next-app-dir — 9d1bf435 Deployed Oct 20, 2024 by vercel[bot]
Preview – examples-todomvc — 9d1bf435 Deployed Oct 20, 2024 by vercel[bot]
Preview – og-image — 9d1bf435 Deployed Oct 20, 2024 by vercel[bot]
trpc-pr-6084 — 9d1bf435 Deployed Oct 20, 2024 by railway-app[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

4 participants