Default to using app-generated AbortSignal for wrapped fetch#4265
Merged
siosonel merged 4 commits intorelease-2.170from Mar 4, 2026
Merged
Default to using app-generated AbortSignal for wrapped fetch#4265siosonel merged 4 commits intorelease-2.170from
siosonel merged 4 commits intorelease-2.170from
Conversation
41e84d5 to
0787040
Compare
…ion if it's missing
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce stale client-side termdb/vocab data requests by ensuring dofetch3() (when invoked as a Vocab/TermdbVocab method) defaults init.signal to an app-generated AbortSignal, so requests can be cancelled on app state changes (e.g. cohort switches).
Changes:
- Update
client/common/dofetch.js:dofetch3()to defaultinit.signalfromthis.app.getAbortSignal()when called as an object method and the caller didn’t provide a signal. - Wire
Vocab/TermdbVocabto calldofetch3as an instance method (this.dofetch3(...)) to enable the above defaulting behavior. - Add error-path cache cleanup to
memFetch()and update related usage/docs/changelog.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/utils/src/fetch-helpers.js | Adds rejection handling in memFetch() to clear cache entries on failed in-flight requests. |
| server/src/mds3.gdc.js | Removes passing q.__abortSignal into a cached /cases memFetch call. |
| client/termdb/Vocab.js | Exposes dofetch3 as an instance method for access to this.app.getAbortSignal(). |
| client/termdb/TermdbVocab.js | Switches termdb API calls from dofetch3(...) to this.dofetch3(...). |
| client/common/dofetch.js | Adds defaulting of init.signal based on the caller’s this context; expands comments. |
| CHANGELOG.md | Documents the behavior change in dofetch3() for vocab usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
4 tasks
Co-authored-by: siosonel <411031+siosonel@users.noreply.github.com>
gavrielm
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes https://gdc-ctds.atlassian.net/browse/SV-2774 and https://gdc-ctds.atlassian.net/browse/SV-2769.
dofetch3(), when called as a Vocab method, will now set an AbortSignal option if it's missing. Previously, chart data requests already supplied an AbortSignal option. This update supplies an AbortSignal even for non-chart data requests, such as for Correlation Plot variable inputs that query term-specific data, so that theapp.dispatch()will not be triggered after such requests. Previously, the detection of stale non-chart data requests was centralized inapp.dispatch(), but that assumed thatapp.dispatch()is triggered before the data request, which may not be true for non-reactive PP components liketermsettingand requests like/termdb/descrstatsthat happen inside termsetting code.Test:
sjpp/master/termdb/descstatsrequest in the Network tab after switching to ALCHEMIST cohort and before the plot data request finishes for TARGETChecklist
Check each task that has been performed or verified to be not applicable.