Skip to content

Commit

Permalink
Revert "move gql to graphql-tag import instead of faulty @apollo/client"
Browse files Browse the repository at this point in the history
This reverts commit f8f44f4.
  • Loading branch information
eric-burel committed Mar 12, 2022
1 parent 7ff8622 commit 5b0e71e
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 65 deletions.
5 changes: 1 addition & 4 deletions packages/meteor-legacy/hooks/currentUser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { useQuery } from "@apollo/client";
import { gql } from "graphql-tag";
import { useQuery, gql } from "@apollo/client";
import get from "lodash/get.js";

import { currentUserFragment } from "../models/user";
Expand Down
16 changes: 5 additions & 11 deletions packages/meteor-legacy/hooks/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,18 @@ import {
MutationHookOptions,
MutationFunctionOptions,
OperationVariables,
gql,
} from "@apollo/client";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";

import { ApolloVariables } from "@vulcanjs/graphql";

// We modify the result function so that variables can be provided as first param,
// which is more intuitive
// Normal mutation function type (sadly not exported directly by Apollo)
type MutationFunction<
TData = any,
TVariables = OperationVariables
> = MutationTuple<TData, TVariables>["0"];
type MutationResult<
TData = any,
TVariables = OperationVariables
> = MutationTuple<TData, TVariables>["1"];
type MutationFunction<TData = any, TVariables = OperationVariables> =
MutationTuple<TData, TVariables>["0"];
type MutationResult<TData = any, TVariables = OperationVariables> =
MutationTuple<TData, TVariables>["1"];

type MutationFunctionResult<TData, TVariables> = ReturnType<
MutationFunction<TData, TVariables>
Expand Down
5 changes: 1 addition & 4 deletions packages/react-hooks/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@

// */

import { useMutation, MutationResult, FetchResult } from "@apollo/client";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";
import { useMutation, MutationResult, gql, FetchResult } from "@apollo/client";

import { filterFunction } from "@vulcanjs/mongo/client";
import {
Expand Down
6 changes: 1 addition & 5 deletions packages/react-hooks/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@
*/

import { useMutation, MutationResult } from "@apollo/client";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";

import { useMutation, MutationResult, gql } from "@apollo/client";
import {
deleteClientTemplate,
Fragment,
Expand Down
6 changes: 1 addition & 5 deletions packages/react-hooks/multi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ Differences with Vulcan Meteor:
*/

import { DocumentNode } from "graphql";
import { useQuery, QueryResult, QueryHookOptions } from "@apollo/client";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";

import { useQuery, gql, QueryResult, QueryHookOptions } from "@apollo/client";
import { useState } from "react";
import {
multiClientTemplate,
Expand Down
4 changes: 1 addition & 3 deletions packages/react-hooks/single.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ import { computeQueryVariables } from "./variables";
import {
OperationVariables,
useQuery,
gql,
QueryResult,
QueryHookOptions,
} from "@apollo/client";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";

const defaultInput = {
enableCache: false,
Expand Down
5 changes: 1 addition & 4 deletions packages/react-hooks/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@

// */

import { useMutation, MutationResult, FetchResult } from "@apollo/client";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";
import { useMutation, MutationResult, gql, FetchResult } from "@apollo/client";

import {
Fragment,
Expand Down
5 changes: 1 addition & 4 deletions packages/react-hooks/upsert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
*/

import { useMutation, MutationResult, FetchResult } from "@apollo/client";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";
import { useMutation, MutationResult, gql, FetchResult } from "@apollo/client";

import { upsertClientTemplate } from "@vulcanjs/graphql";

Expand Down
2 changes: 1 addition & 1 deletion packages/react-ui/components/Datatable/DatatableFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from "react";
import { DocumentNode } from "@apollo/client";
import { DocumentNode, gql } from "@apollo/client";
import { useQuery } from "@apollo/client";
import moment from "moment";
import isEmpty from "lodash/isEmpty.js";
Expand Down
5 changes: 1 addition & 4 deletions packages/react-ui/components/MutationButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ Example Usage
*/
import React, { useState } from "react";
import { DocumentNode } from "graphql";
import { MutationHookOptions, useMutation } from "@apollo/client";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";
import { gql, MutationHookOptions, useMutation } from "@apollo/client";
import { useVulcanComponents } from "./VulcanComponents/Consumer";
import { LoadingButtonProps } from "./LoadingButton";
// import withMutation from '../containers/registeredMutation';
Expand Down
5 changes: 1 addition & 4 deletions packages/react-ui/components/form/FormComponentLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import React, { useEffect } from "react";
// @see packages/vulcan-lib/lib/modules/fragments.js in Vulcan
// should we reenable this?
// import { expandQueryFragments } from "meteor/vulcan:core";
import { useLazyQuery } from "@apollo/client";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";
import { useLazyQuery, gql } from "@apollo/client";
import isEmpty from "lodash/isEmpty.js";
import { useVulcanComponents } from "../VulcanComponents/Consumer";

Expand Down
5 changes: 1 addition & 4 deletions packages/react-ui/components/form/FormContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ import React, { useRef } from "react";
// Utils,
// getFragment,
//"meteor/vulcan:core";
import { DocumentNode } from "@apollo/client";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";
import { DocumentNode, gql } from "@apollo/client";

import getFormFragments from "./modules/formFragments";
// import { VulcanModel } from "@vulcanjs/model";
Expand Down
4 changes: 1 addition & 3 deletions packages/react-ui/components/form/modules/formFragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
*/
import _uniq from "lodash/uniq.js";
import _intersection from "lodash/intersection.js";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";
import { gql } from "@apollo/client";
import {
getCreateableFields,
getUpdateableFields,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import {
import { OneFieldGraphql, OneFieldType } from "./fixtures/graphqlModels";

import { getMswServer } from "@vulcanjs/utils/testing";
// @see https://stackoverflow.com/questions/70615613/apollo-client-named-export-remove-not-found
// get gql from graphql-tag directly works with ESM
import { gql } from "graphql-tag";
import { gql } from "@apollo/client";

beforeEach(() => {
// add relevant mocks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { Story, Meta } from "@storybook/react";
import { MutationButton, MutationButtonProps } from "../MutationButton";
import { gql } from "graphql-tag";
import { gql } from "@apollo/client";
import { VulcanComponentsProvider } from "../VulcanComponents";
export default {
component: MutationButton,
Expand Down
7 changes: 2 additions & 5 deletions packages/utils/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"extends": "./tsconfig.json",
"include": [
"./index.ts",
"./testing.ts"
]
}
"include": ["./index.ts"]
}

0 comments on commit 5b0e71e

Please sign in to comment.