-
Notifications
You must be signed in to change notification settings - Fork 178
[Patch] Ensure the abort signal is properly passing through to the request #2684
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
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.
Pull Request Overview
This patch ensures the abort signal
option is correctly propagated through GraphQL and REST requests and updates related tests and utilities.
- Updated GraphQL client utilities and types to handle an optional
signal
parameter. - Introduced
mockRequestCapture
in the mock adapter to recordRequestInit
and reset it in tests. - Revised tests in multiple packages to assert that the abort
signal
is passed tofetch
or the mock adapter.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/apps/shopify-app-remix/src/server/authenticate/admin/tests/admin-client.test.ts | Add test to verify abort signal is passed to fetch |
packages/apps/shopify-app-react-router/src/server/authenticate/admin/tests/admin-client.test.ts | Add test to verify abort signal propagation |
packages/apps/shopify-api/lib/clients/admin/tests/admin_graphql_client.test.ts | Update GraphQL client test to capture and assert the abort signal |
packages/apps/shopify-api/adapters/mock/adapter.ts | Introduce mockRequestCapture to record RequestInit including signal |
packages/apps/shopify-api/adapters/mock/mock_test_requests.ts | Reset mockRequestCapture in the mock reset method |
packages/api-clients/graphql-client/src/api-client-utilities/utilities.ts | Extend generateGetGQLClientParams to forward signal option |
packages/api-clients/graphql-client/src/api-client-utilities/types.ts | Add signal?: AbortSignal to request options type |
packages/api-clients/graphql-client/src/api-client-utilities/tests/utilities.test.ts | Add unit test for signal in generated GraphQL client params |
.changeset/curly-masks-feel.md | Record patch entries for signal support |
Comments suppressed due to low confidence (3)
packages/api-clients/graphql-client/src/api-client-utilities/tests/utilities.test.ts:147
- [nitpick] You may also want to add a test that combines
signal
with other options (e.g.,retries
,headers
,variables
) to verify that all options are merged correctly.
it('returns an array with the operation string and an option with signal when an abort signal was provided', () => {
packages/apps/shopify-app-remix/src/server/authenticate/admin/tests/admin-client.test.ts:183
- [nitpick] It’s best to reset
fetchMock
before this test (e.g., in abeforeEach
) to ensure no prior calls interfere with the call count assertion.
it('passes abort signal through to fetch request', async () => {
packages/apps/shopify-app-react-router/src/server/authenticate/admin/tests/admin-client.test.ts:37
- [nitpick] Consider resetting
fetchMock
in abeforeEach
block here as well to isolate this test and avoid residual mock calls.
it('passes abort signal through to fetch request', async () => {
headers, | ||
retries, | ||
signal, | ||
} = options as any; |
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.
Avoid using as any
here. You can extend the RequestParams
type (or the function signature) to include signal
so you keep full type safety instead of casting to any
.
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
ee9f210
to
ca3c24d
Compare
ca3c24d
to
3100acd
Compare
WHY are these changes introduced?
Fixes #2643
WHAT is this pull request doing?
screencast.2025-07-17.09-33-35.mp4
Type of change
Checklist
pnpm changeset
to create a draft changelog entry (do NOT update theCHANGELOG.md
files manually)