Closed OmarShref closed 1 year ago
See: https://github.com/urql-graphql/urql/commit/d17a1c256a04655b05006539dd69a0813e2f51c4
This is working just fine as far as I can tell.
Please do note, if you have a question, we've got Discord and GH Discussions available, but issues are reserved for bugs where you have a clear reproduction or path/reason to believe it's not a usage issue 😅
On a side note, I obviously don't know what you're up to or need, but please keep in mind that settings requestPolicy: "network-only"
on the Client
as a default, as per the TSDocs notes, is not recommended and will likely not lead to the behaviour you expect. That said, it's unrelated to this issue.
You've posted code above, but that's not a proper reproduction, however, it's also not functional code. So, I can only assume that since the client is "free-floating" there that you may have duplicate clients or duplicate places where you may define its configuration, and I'm not sure whether preferGetMethod
is applied to the Client
that's used. Does that sound plausible to you? 🤔
I'll go ahead with closing this for now, but obviously, feel free to keep responding here and I'm happy to help how I can :v:
Describe the bug
urql dosn't respect prefergetmethod value and always send post requests what ever the value that is given to it
Reproduction
"use client"; import Category from "./Category"; import { Client, Provider, cacheExchange, fetchExchange } from "urql"; const client = new Client({ url: "https://v2-api.alsaifgallery.com/graphql", exchanges: [cacheExchange, fetchExchange], preferGetMethod: "force", requestPolicy: "network-only", fetchOptions: { headers: { store: storeCode, }, }, }); const CategoryWrapper = ({ categoryId, storeCode, categoryName, initialCategoryData, }) => { return ( <> <Category categoryId={categoryId} categoryName={ </> ); }; export default CategoryWrapper;
${categoryName}
} storeCode={${storeCode}
} initialCategoryData={initialCategoryData} />Urql version
Validations