From 199eae33d99d4ee171d17bb2cfd2516c40d72e8b Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Sun, 25 Oct 2020 22:33:52 +0200 Subject: [PATCH] fix apollo warning --- lib/apollo.ts | 12 +++++++++++- pages/u/[identifier].tsx | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/apollo.ts b/lib/apollo.ts index d49fcf6f3..b8b8152db 100644 --- a/lib/apollo.ts +++ b/lib/apollo.ts @@ -28,7 +28,17 @@ function createApolloClient(context?: Context) { return new ApolloClient({ ssrMode: typeof window === "undefined", link: createIsomorphLink(context), - cache: new InMemoryCache(), + cache: new InMemoryCache({ + typePolicies: { + User: { + fields: { + profile: { + merge: false, + }, + }, + }, + }, + }), }); } diff --git a/pages/u/[identifier].tsx b/pages/u/[identifier].tsx index 83583610f..b8a193c2b 100644 --- a/pages/u/[identifier].tsx +++ b/pages/u/[identifier].tsx @@ -46,8 +46,9 @@ const ProfilePage = ({ identifier }: { identifier: string }) => { // FIXME: handle fallback const getUserByIdentifier = data?.getUserByIdentifier; - if (!getUserByIdentifier && typeof window !== "undefined") + if (!getUserByIdentifier && typeof window !== "undefined") { router.push("/404"); + } return getUserByIdentifier ? : null; };