From 1c6cae4d1007e6b4646a166adb409a29016f2a32 Mon Sep 17 00:00:00 2001 From: Mitja Debeljak Date: Wed, 15 Jan 2020 10:55:36 +0100 Subject: [PATCH] initial try --- modules/core/common/createApolloClient.ts | 14 ++++++++++---- modules/user/client-react/containers/Users.web.jsx | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/core/common/createApolloClient.ts b/modules/core/common/createApolloClient.ts index ea298d6b50..ff0d6716b1 100644 --- a/modules/core/common/createApolloClient.ts +++ b/modules/core/common/createApolloClient.ts @@ -2,7 +2,7 @@ import fetch from 'isomorphic-unfetch'; import { getOperationAST } from 'graphql'; import { BatchHttpLink } from 'apollo-link-batch-http'; import { ApolloLink } from 'apollo-link'; -import { withClientState } from 'apollo-link-state'; +// import { withClientState } from 'apollo-link-state'; import { WebSocketLink } from 'apollo-link-ws'; import { InMemoryCache } from 'apollo-cache-inmemory'; import { LoggingLink } from 'apollo-logger'; @@ -116,11 +116,11 @@ const createApolloClient = ({ ); } - const linkState = withClientState({ ...clientResolvers, cache }); + // const linkState = withClientState({ ...clientResolvers, cache }); const allLinks = [ ...(createLink ? createLink.map((create: any) => create(getApolloClient)) : []), - linkState, + // linkState, apiLink ]; @@ -153,7 +153,13 @@ const createApolloClient = ({ const client = new ApolloClient(clientParams); if (cache.constructor.name !== 'OverrideCache') { // Restore Apollo Link State defaults only if we don't use `apollo-cache-router` - client.onResetStore((linkState as any).writeDefaults); + // client.onResetStore((linkState as any).writeDefaults); + + localCache.writeData({ + data: { + ...clientResolvers.defaults + } + }); } if (typeof window !== 'undefined' && window.__APOLLO_STATE__) { diff --git a/modules/user/client-react/containers/Users.web.jsx b/modules/user/client-react/containers/Users.web.jsx index 2b925655a1..829c26e40e 100644 --- a/modules/user/client-react/containers/Users.web.jsx +++ b/modules/user/client-react/containers/Users.web.jsx @@ -22,6 +22,7 @@ import { const Users = props => { const { t, updateQuery, subscribeToMore } = props; + console.log('props.filter:', props.filter); const filter = { isActive: true }; const usersUpdated = useUsersWithSubscription(subscribeToMore, filter);