fix apollo warning

This commit is contained in:
Kalle (Sendou) 2020-10-25 22:33:52 +02:00
parent 53a8964f84
commit 199eae33d9
2 changed files with 13 additions and 2 deletions

View File

@ -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,
},
},
},
},
}),
});
}

View File

@ -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 ? <Profile user={getUserByIdentifier} /> : null;
};