Skip to content

Commit 03c7e39

Browse files
author
Andrey Okonetchnikov
committed
feat: Enable cache persistance in the localStorage
1 parent 9b850db commit 03c7e39

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/Provider.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as React from "react";
1+
import * as React from "react"
22
import ApolloClient from "apollo-client"
33
import { ApolloProvider } from "react-apollo"
44
import {
@@ -9,7 +9,7 @@ import { HttpLink } from "apollo-link-http"
99
import { WebSocketLink } from "apollo-link-ws"
1010
import { split } from "apollo-link"
1111
import { getMainDefinition } from "apollo-utilities"
12-
// import { persistCache } from "apollo-cache-persist"
12+
import { persistCache } from "apollo-cache-persist"
1313
import * as introspectionQueryResultData from "../fragmentTypes.json"
1414

1515
interface IProvider {
@@ -25,11 +25,10 @@ export default function Provider({ children, host, wsHost }: IProvider) {
2525

2626
const cache = new InMemoryCache({ fragmentMatcher })
2727

28-
// persistCache({
29-
// cache,
30-
// storage: window.localStorage,
31-
// debug: true
32-
// })
28+
persistCache({
29+
cache,
30+
storage: window.localStorage
31+
})
3332

3433
const httpLink = new HttpLink({
3534
uri: `${host}/graphql`

0 commit comments

Comments
 (0)