fix: use 'within-url-limit'
for APQ requests
#379
Merged
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.
Why are these changes introduced?
Addresses ENG-9515
As described in urql-graphql/urql#3185,
@urql/exchange-persisted
currently sets urql'spreferGetMethod
setting to'force'
. This was causing problems with an especially large query inreference-stores/next/pages/collections/[handle].js
.This issue is demonstrated with
@nacelle/storefront-sdk@/2.0.0-beta.10
in https://codesandbox.io/s/nacelle-storefront-sdk-2-0-0-demo-failure-to-fetch-with-prefergetmethod-force-2u9kjm.What is this pull request doing?
This PR patches
@urql/exchange-persisted
usingpatch-package
. The patch changes thepreferGetMethod
setting from'force'
to'within-url-limit'
when@urql/exchange-persisted
'spreferGetForPersistedQueries
setting is set totrue
.How to Test
ENG-9515/patch-urql-exchange-persisted
branchnpm run bootstrap
from the monorepo rootpackages/storefront-sdk
npm run build
- the package should build without issuesnpm run coverage
- all tests should pass with 100% coveragereference-stores/next
npm run build
- the project should build without errorsI tested this change by publishing
@nacelle/storefront-sdk@2.0.0-hotfix.0
with thev2-hotfix
tag, and using it in a forked version of the bug demo Code Sandbox from above. As show in https://codesandbox.io/s/nacelle-storefront-sdk-2-0-0-demo-prefergetmethod-within-url-limits-hb0zkm?file=/src/index.ts, the request succeeds. Interestingly, it succeeds with a GET, without converting the request to a POST. I'm not yet sure why this works, but it's a good result nonetheless.Checklist
nacelle-js
' Code of Conduct.