-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(start): discard stream controller errors when closed #3161
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
Conversation
View your CI Pipeline Execution ↗ for commit 7bb69a8.
☁️ Nx Cloud last updated this comment at |
92b9a63
to
c482172
Compare
controller = { | ||
enqueue: (chunk: unknown) => { try { c.enqueue(chunk); } catch {} }, | ||
close: () => { try { c.close(); } catch {} }, | ||
} |
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.
Doing this here seems to be the place that is the most defensive - anywhere "further out", it could swallow errors e.g. if controller is still undefined etc.
Force-pushed to reflect the latest change with |
* add `(TeeTo|ReadFrom)ReadableStreamLink` links * add `skipDataTransport` function * also export type `ReadableStreamLinkEvent` * forgot file * implement multipart streaming * cleanup * WIP * handle re-consumption of readFromReadableStreamKey * close on unsubscribe, catch errors * tryClose, test adjustments * adjust errorlink type * streamline bundling * fix jest integration test * PreloadQuery: add `@defer` example * add detail, suspense-transition-bug * work around bug for now * exports * add exported types * initialize basic react-router project * clean up and `yarn react-router reveal` * add raw experiment * move eslint config into shared position * Fix bundling configuration so parts of the `graphql` package don't end (#388) * Release version 0.11.6@latest to npm * Update peer deps for React 19 compatibility (#399) * update devDependencies to React 19, adjust tests and examples (#400) * Release version 0.11.7@latest to npm * add example * update react-router * working * patch PR in * last adjustments * fix up test for new deps * clean up template fluff * move `IncrementalSchemaLink` and others to `shared` * use `@defer` in the example * update turbo-stream patch * update example to React 19 * adjust `prepublishOnly` * add to pkg-pr-new-publish * add empty unit test * increase delay * streamline integration test build * needs more time in CI * exclude shared * copy react-router package to tanstack-start folder * package init * init tanstack start project * current progress * fix duplicate `@apollo/client` dependency * make things work * adjustments * generalize apiRoute * api, use schemalink on server * update tanstack start * add TSR devtools * workaround for TanStack/router#3117 * trigger CI * update patchfiles * add new properties * changeset * trigger CI * fix build warning * port over vercel template from https://github.com/remix-run/react-router-templates/tree/main/vercel * adjust folder structure * more vercel adjustments * use `promiscade` instead of a patched `turbo-stream` package * update promiscade * add promiscade-related comment * lockfile * workarounds for promiscade * move `graphql` dependency into monorepo to prevent type mismatches * adjust comments * these types are correct now * update lockfile * rename route * add `useSuspenseQuery` demo, too * fix import * simplify client-side * remove log * remove unneccessary type assertion * slight changes, README * fix up important block * fix typo, reorder * fixup shape test * add bundleInfo, adjust tests * adjust tests * adjust for old node * add globalThis.window in test * bump promiscade * update tanstack start, remove workaround for fixed bug * update package.json * add TanStack/router#3161 * lockfile * update correct react types * eliminate context reliance this makes it easier to use `yalc` * sync updates from TanStack/router#2698 * lockfiles * script * fighting with duplicate dependencies * unify react types version * remove unused path * more config file mentions * TSR 6d6780b255c458e9776f15c134d93fab0aeafa80 * pass `request` to `makeClient` in entry.server.tsx * delete file after merge * lockfile * Update packages/tanstack-start/README.md Co-authored-by: Jerel Miller <[email protected]> --------- Co-authored-by: phryneas <[email protected]> Co-authored-by: Nick Muller <[email protected]> Co-authored-by: Jerel Miller <[email protected]>
Stream Controller: try enqueue/close without throwing error
Both
controller.enqueue
andcontroller.close
throw an error if the stream has already been closed.This could be the case because the reading side just doesn't have interest in more incoming values and has closed the stream on the reading side.
Up until now, this would cause an error to be thrown on the console once more chunks or a close request were streamed in.
This wraps
.close
and.enqueue
in atry..catch
block and disregards the result.Reading the standard I don't see any possible other reasons for an error to be thrown, so this should be fine.