Memoizing fetch error: Body is unusable #802
Unanswered
MangoMarcus
asked this question in
Q&A
Replies: 1 comment
-
Hi @jasonkuhrt , I see you've converted this to a discussion - does that mean it's not a bug then? Thanks |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I've tried to memoize the fetch function for graphql-request using lodash.memoize, but it gives "Error: Body is unusable". Is this a bug or am I missing something?
Thanks
Reproduction Steps/Repo Link
Screenshot
For reference the
gqlSdk
in the screenshot is generated by graphql-codegen usingimport { getSdk, type SdkFunctionWrapper } from '@/generated/gql/sdk'; export const gqlSdk = getSdk(gqlClient);
, it's just a simple wrapper aroundgqlClient.request
though so the effect should be the same:Workaround
I've worked around the issue for now by memoizing the individual methods in that sdk instead of the underlying fetch
Beta Was this translation helpful? Give feedback.
All reactions