Skip to content

Commit c570e03

Browse files
committed
feat: make apq a explicitly opt in feature
* fixed an issue were POST calls where implicitly converted into GET calls when a documentId was provided, even though apq was not enabled. * removed a deprecated isPersistedQuery flag
1 parent 629d4a7 commit c570e03

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

.changeset/pre.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mode": "pre",
3+
"tag": "beta",
4+
"initialVersions": {
5+
"@labdigital/graphql-fetcher": "2.0.0"
6+
},
7+
"changesets": []
8+
}

.changeset/rich-ants-shop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@labdigital/graphql-fetcher": major
3+
---
4+
5+
Remove deprecated is "isPersistedQuery" and make apq explicitly opt in

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@
7070
"react-dom": ">= 18.2.0"
7171
},
7272
"packageManager": "[email protected]"
73-
}
73+
}

src/client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe("gqlClientFetch", () => {
3737

3838
const fetcher = initClientFetcher("https://localhost/graphql");
3939
const persistedFetcher = initClientFetcher("https://localhost/graphql", {
40-
persistedQueries: true,
40+
apq: true,
4141
});
4242

4343
it("should perform a query", async () => {

src/client.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ type Options = {
2525
*/
2626
apq?: boolean;
2727

28-
/** Deprecated: use `apq: <boolean>` */
29-
persistedQueries?: boolean;
30-
3128
/**
3229
* Sets the default timeout duration in ms after which a request will throw a timeout error
3330
*
@@ -71,7 +68,6 @@ export const initClientFetcher =
7168
endpoint: string,
7269
{
7370
apq = false,
74-
persistedQueries = false,
7571
defaultTimeout = 30000,
7672
defaultHeaders = {},
7773
includeQuery = false,
@@ -110,10 +106,8 @@ export const initClientFetcher =
110106

111107
const queryType = getQueryType(query);
112108

113-
apq = apq || persistedQueries;
114-
115109
// For queries we can use GET requests if persisted queries are enabled
116-
if (queryType === "query" && (apq || isPersistedQuery(request))) {
110+
if (queryType === "query" && apq) {
117111
const url = createRequestURL(endpoint, request);
118112
response = await parseResponse<GqlResponse<TResponse>>(() =>
119113
fetch(url.toString(), {

0 commit comments

Comments
 (0)