1
Fork 0

Properly merge SiteInfo in Apollo cache

This solves #146
This commit is contained in:
viktorstrate 2020-12-09 16:58:40 +01:00
parent d4900b76d0
commit 4980a77efb
No known key found for this signature in database
GPG Key ID: 3F855605109C1E8A
2 changed files with 14 additions and 2 deletions

View File

@ -11,7 +11,9 @@
"mode": "auto", "mode": "auto",
"program": "${workspaceRoot}/server.go", "program": "${workspaceRoot}/server.go",
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"env": {}, "env": {
"PATH": "${env:PATH}:/Applications/darktable.app/Contents/MacOS/"
},
"args": [] "args": []
} }
] ]

View File

@ -104,10 +104,20 @@ const linkError = onError(({ graphQLErrors, networkError }) => {
} }
}) })
const memoryCache = new InMemoryCache({
typePolicies: {
// There only exists one global instance of SiteInfo,
// therefore it can always be merged
SiteInfo: {
merge: true,
},
},
})
const client = new ApolloClient({ const client = new ApolloClient({
// link: ApolloLink.from([linkError, authLink.concat(link)]), // link: ApolloLink.from([linkError, authLink.concat(link)]),
link: ApolloLink.from([linkError, link]), link: ApolloLink.from([linkError, link]),
cache: new InMemoryCache(), cache: memoryCache,
}) })
export default client export default client