You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is the following example under "Usage example (isReactHook: false)":
// I have removed some of the config objects to focus more on the issueexportconstfetchData=<TData,TVariables>(query: string,variables?: TVariables,options?: RequestInit['headers']): (()=>Promise<TData>)=>{returnasync()=>{constres=awaitfetch('https://api.url',{...});constjson=awaitres.json()if(json.errors){const{ message }=json.errors[0]||{}thrownewError(message||'Error…')}returnjson.data}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I am raising this question regarding: https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-react-query#usage-example-isreacthook-false
There is the following example under "Usage example (isReactHook: false)":
This method throws if there are any errors. This means we lose all the data that was successfully received. (e.g. https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
Should it instead not be like the following, to still be able to use partial data?
Beta Was this translation helpful? Give feedback.
All reactions