Skip to content

Commit

Permalink
Refactor apollo imports (#5456)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint authored Nov 11, 2024
1 parent a6d9b8b commit 4302bfe
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 28 deletions.
4 changes: 3 additions & 1 deletion apps/web/src/components/Common/Providers/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApolloProvider } from "@apollo/client";
import authLink from "@helpers/authLink";
import { ApolloProvider, apolloClient } from "@hey/lens/apollo";
import apolloClient from "@hey/lens/apollo/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ThemeProvider } from "next-themes";
import type { FC, ReactNode } from "react";
Expand All @@ -14,6 +15,7 @@ import ServiceWorkerProvider from "./ServiceWorkerProvider";
import Web3Provider from "./Web3Provider";

const lensApolloClient = apolloClient(authLink);

const queryClient = new QueryClient({
defaultOptions: { queries: { refetchOnWindowFocus: false } }
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useApolloClient } from "@apollo/client";
import { getAuthApiHeadersWithAccessToken } from "@helpers/getAuthApiHeaders";
import { Leafwatch } from "@helpers/leafwatch";
import { BanknotesIcon, DocumentTextIcon } from "@heroicons/react/24/outline";
Expand All @@ -6,7 +7,6 @@ import { GARDENER } from "@hey/data/tracking";
import stopEventPropagation from "@hey/helpers/stopEventPropagation";
import type { MirrorablePublication } from "@hey/lens";
import { PublicationReportingSpamSubreason } from "@hey/lens";
import { useApolloClient } from "@hey/lens/apollo";
import { Button } from "@hey/ui";
import axios from "axios";
import { useRouter } from "next/router";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ApolloCache } from "@apollo/client";
import { MenuItem } from "@headlessui/react";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
Expand All @@ -13,7 +14,6 @@ import {
useAddPublicationBookmarkMutation,
useRemovePublicationBookmarkMutation
} from "@hey/lens";
import type { ApolloCache } from "@hey/lens/apollo";
import cn from "@hey/ui/cn";
import { useCounter, useToggle } from "@uidotdev/usehooks";
import { useRouter } from "next/router";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ApolloCache } from "@apollo/client";
import { useHiddenCommentFeedStore } from "@components/Publication";
import { MenuItem } from "@headlessui/react";
import errorToast from "@helpers/errorToast";
Expand All @@ -11,7 +12,6 @@ import type {
UnhideCommentRequest
} from "@hey/lens";
import { useHideCommentMutation, useUnhideCommentMutation } from "@hey/lens";
import type { ApolloCache } from "@hey/lens/apollo";
import cn from "@hey/ui/cn";
import type { FC } from "react";
import { toast } from "react-hot-toast";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ApolloCache } from "@apollo/client";
import { MenuItem } from "@headlessui/react";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
Expand All @@ -12,7 +13,6 @@ import {
useAddPublicationNotInterestedMutation,
useUndoPublicationNotInterestedMutation
} from "@hey/lens";
import type { ApolloCache } from "@hey/lens/apollo";
import cn from "@hey/ui/cn";
import type { FC } from "react";
import { toast } from "react-hot-toast";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useApolloClient } from "@apollo/client";
import { MenuItem } from "@headlessui/react";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
Expand All @@ -7,7 +8,6 @@ import { PUBLICATION } from "@hey/data/tracking";
import { isMirrorPublication } from "@hey/helpers/publicationHelpers";
import type { AnyPublication } from "@hey/lens";
import { useHidePublicationMutation } from "@hey/lens";
import { useApolloClient } from "@hey/lens/apollo";
import cn from "@hey/ui/cn";
import type { Dispatch, FC, SetStateAction } from "react";
import { toast } from "react-hot-toast";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Publication/QueuedPublication.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useApolloClient } from "@apollo/client";
import Markup from "@components/Shared/Markup";
import SmallSingleProfile from "@components/Shared/SmallSingleProfile";
import getMentions from "@hey/helpers/getMentions";
Expand All @@ -8,7 +9,6 @@ import {
useLensTransactionStatusQuery,
usePublicationLazyQuery
} from "@hey/lens";
import { useApolloClient } from "@hey/lens/apollo";
import type { OptimisticTransaction } from "@hey/types/misc";
import { Card, Tooltip } from "@hey/ui";
import type { FC } from "react";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Settings/Interests/Interests.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useApolloClient } from "@apollo/client";
import Loader from "@components/Shared/Loader";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
Expand All @@ -12,7 +13,6 @@ import {
useProfileInterestsOptionsQuery,
useRemoveProfileInterestsMutation
} from "@hey/lens";
import { useApolloClient } from "@hey/lens/apollo";
import { Button } from "@hey/ui";
import type { FC } from "react";
import toast from "react-hot-toast";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useApolloClient } from "@apollo/client";
import LazyDefaultProfile from "@components/Shared/LazyDefaultProfile";
import Loader from "@components/Shared/Loader";
import errorToast from "@helpers/errorToast";
Expand All @@ -16,7 +17,6 @@ import {
useCreateChangeProfileManagersTypedDataMutation,
useProfileManagersQuery
} from "@hey/lens";
import { useApolloClient } from "@hey/lens/apollo";
import { Button, EmptyState, ErrorMessage } from "@hey/ui";
import type { FC } from "react";
import { useState } from "react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ApolloCache } from "@apollo/client";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
import { LensHub } from "@hey/abis";
Expand All @@ -15,7 +16,6 @@ import {
useCreateUnblockProfilesTypedDataMutation,
useUnblockMutation
} from "@hey/lens";
import type { ApolloCache } from "@hey/lens/apollo";
import { Alert } from "@hey/ui";
import type { FC } from "react";
import { useState } from "react";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Shared/Profile/Follow.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useApolloClient } from "@apollo/client";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
import { LensHub } from "@hey/abis";
Expand All @@ -12,7 +13,6 @@ import {
useCreateFollowTypedDataMutation,
useFollowMutation
} from "@hey/lens";
import { useApolloClient } from "@hey/lens/apollo";
import { OptmisticPublicationType } from "@hey/types/enums";
import type { OptimisticTransaction } from "@hey/types/misc";
import { Button } from "@hey/ui";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useApolloClient } from "@apollo/client";
import AllowanceButton from "@components/Settings/Allowance/Button";
import Loader from "@components/Shared/Loader";
import NoBalanceError from "@components/Shared/NoBalanceError";
Expand Down Expand Up @@ -26,7 +27,6 @@ import {
useCreateFollowTypedDataMutation,
useProfileQuery
} from "@hey/lens";
import { useApolloClient } from "@hey/lens/apollo";
import { Button, H3, H5, WarningMessage } from "@hey/ui";
import Link from "next/link";
import { useRouter } from "next/router";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Shared/Profile/Unfollow.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useApolloClient } from "@apollo/client";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
import { LensHub } from "@hey/abis";
Expand All @@ -12,7 +13,6 @@ import {
useCreateUnfollowTypedDataMutation,
useUnfollowMutation
} from "@hey/lens";
import { useApolloClient } from "@hey/lens/apollo";
import { OptmisticPublicationType } from "@hey/types/enums";
import type { OptimisticTransaction } from "@hey/types/misc";
import { Button } from "@hey/ui";
Expand Down
17 changes: 2 additions & 15 deletions packages/lens/apollo/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
import {
ApolloCache,
ApolloProvider,
gql,
useApolloClient,
useQuery
} from "@apollo/client";
import { ApolloCache, ApolloProvider } from "@apollo/client";
import apolloClient from "./client";

export {
ApolloCache,
apolloClient,
ApolloProvider,
gql,
useApolloClient,
useQuery
};
export { ApolloCache, apolloClient, ApolloProvider };

1 comment on commit 4302bfe

@vercel
Copy link

@vercel vercel bot commented on 4302bfe Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web – ./

web-heyxyz.vercel.app
heyxyz.vercel.app
web-git-main-heyxyz.vercel.app
hey.xyz

Please sign in to comment.