Skip to content

Commit c76672d

Browse files
Revert "fix(hasura): meta.gqlVariables passed to deleteOne Hasura DataProvider" (#6792)
1 parent c62a8aa commit c76672d

File tree

4 files changed

+1
-169
lines changed

4 files changed

+1
-169
lines changed

.changeset/friendly-feet-marry.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/hasura/src/dataProvider/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ const dataProvider = (
471471
if (meta?.gqlMutation) {
472472
const response = await client.request<BaseRecord>(meta.gqlMutation, {
473473
id,
474-
...meta?.gqlVariables,
474+
...meta?.variables,
475475
});
476476

477477
return {

packages/hasura/test/deleteOne/index.mock.ts

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -448,105 +448,3 @@ nock("https://ruling-redbird-23.hasura.app:443", { encodedQueryParams: true })
448448
"8437587e1f6a733a-BUD",
449449
],
450450
);
451-
452-
nock("https://flowing-mammal-24.hasura.app:443", { encodedQueryParams: true })
453-
.post("/v1/graphql", {
454-
query:
455-
"mutation DeletePost($id: uuid!, $includeTitle: Boolean = false) {\n delete_posts_by_pk(id: $id) {\n id\n title @include(if: $includeTitle)\n }\n}\n",
456-
variables: {
457-
id: "9a83b4c2-5d1e-47f6-b9c5-3a2d8e1f0c7b",
458-
includeTitle: true,
459-
},
460-
operationName: "DeletePost",
461-
})
462-
.reply(
463-
200,
464-
{
465-
data: {
466-
delete_posts_by_pk: {
467-
id: "9a83b4c2-5d1e-47f6-b9c5-3a2d8e1f0c7b",
468-
title: "Aenean ultricies non libero sit amet pellentesque",
469-
},
470-
},
471-
},
472-
[
473-
"Date",
474-
"Wed, 10 Jan 2024 19:32:24 GMT",
475-
"Content-Type",
476-
"application/json; charset=utf-8",
477-
"Content-Length",
478-
"137",
479-
"Connection",
480-
"close",
481-
"x-request-id",
482-
"7d98c24a10b32a6e7c1f5d9b8e4a2c1d",
483-
"CF-Cache-Status",
484-
"DYNAMIC",
485-
"Content-Security-Policy",
486-
"upgrade-insecure-requests",
487-
"Referrer-Policy",
488-
"strict-origin-when-cross-origin",
489-
"Strict-Transport-Security",
490-
"max-age=31536000; includeSubDomains",
491-
"X-Content-Type-Options",
492-
"nosniff",
493-
"X-Frame-Options",
494-
"SAMEORIGIN",
495-
"X-XSS-Protection",
496-
"0",
497-
"Server",
498-
"cloudflare",
499-
"CF-RAY",
500-
"84375883ac84684c-BUD",
501-
],
502-
);
503-
504-
nock("https://flowing-mammal-24.hasura.app:443", { encodedQueryParams: true })
505-
.post("/v1/graphql", {
506-
query:
507-
"mutation DeletePost($id: uuid!, $includeTitle: Boolean = false) {\n delete_posts_by_pk(id: $id) {\n id\n title @include(if: $includeTitle)\n }\n}\n",
508-
variables: {
509-
id: "7b5c8a2d-6e9f-4a1b-8c3d-2e0f5a9b4c7d",
510-
},
511-
operationName: "DeletePost",
512-
})
513-
.reply(
514-
200,
515-
{
516-
data: {
517-
delete_posts_by_pk: {
518-
id: "7b5c8a2d-6e9f-4a1b-8c3d-2e0f5a9b4c7d",
519-
},
520-
},
521-
},
522-
[
523-
"Date",
524-
"Wed, 10 Jan 2024 19:32:25 GMT",
525-
"Content-Type",
526-
"application/json; charset=utf-8",
527-
"Content-Length",
528-
"77",
529-
"Connection",
530-
"close",
531-
"x-request-id",
532-
"3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d",
533-
"CF-Cache-Status",
534-
"DYNAMIC",
535-
"Content-Security-Policy",
536-
"upgrade-insecure-requests",
537-
"Referrer-Policy",
538-
"strict-origin-when-cross-origin",
539-
"Strict-Transport-Security",
540-
"max-age=31536000; includeSubDomains",
541-
"X-Content-Type-Options",
542-
"nosniff",
543-
"X-Frame-Options",
544-
"SAMEORIGIN",
545-
"X-XSS-Protection",
546-
"0",
547-
"Server",
548-
"cloudflare",
549-
"CF-RAY",
550-
"8437588b1d56733a-BUD",
551-
],
552-
);

packages/hasura/test/deleteOne/index.spec.ts

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -137,65 +137,4 @@ describe("with gqlMutation", () => {
137137

138138
expect(data.id).toEqual(id);
139139
});
140-
141-
it("correctly passes variables from meta.gqlVariables to the query", async () => {
142-
const id = "9a83b4c2-5d1e-47f6-b9c5-3a2d8e1f0c7b";
143-
144-
const client = createClient("hasura-default");
145-
const { data } = await dataProvider(client, {
146-
namingConvention: "hasura-default",
147-
}).deleteOne({
148-
resource: "posts",
149-
id,
150-
meta: {
151-
gqlMutation: gql`
152-
mutation DeletePost(
153-
$id: uuid!,
154-
$includeTitle: Boolean = false
155-
) {
156-
delete_posts_by_pk(id: $id) {
157-
id
158-
title @include(if: $includeTitle)
159-
}
160-
}
161-
`,
162-
gqlVariables: {
163-
includeTitle: true,
164-
},
165-
},
166-
});
167-
168-
expect(data.id).toEqual(id);
169-
expect(data.title).toEqual(
170-
"Aenean ultricies non libero sit amet pellentesque",
171-
);
172-
});
173-
174-
it("doesn't pass extra variables to the query without meta.gqlVariables", async () => {
175-
const id = "7b5c8a2d-6e9f-4a1b-8c3d-2e0f5a9b4c7d";
176-
177-
const client = createClient("hasura-default");
178-
const { data } = await dataProvider(client, {
179-
namingConvention: "hasura-default",
180-
}).deleteOne({
181-
resource: "posts",
182-
id,
183-
meta: {
184-
gqlMutation: gql`
185-
mutation DeletePost(
186-
$id: uuid!,
187-
$includeTitle: Boolean = false
188-
) {
189-
delete_posts_by_pk(id: $id) {
190-
id
191-
title @include(if: $includeTitle)
192-
}
193-
}
194-
`,
195-
},
196-
});
197-
198-
expect(data.id).toEqual(id);
199-
expect(data.title).toBeUndefined();
200-
});
201140
});

0 commit comments

Comments
 (0)