aerogear / offix

GraphQL Offline Client and Server
https://offix.dev
Apache License 2.0
758 stars 45 forks source link

Use apollo-cache-persist-dev in offix-client #174

Closed wtrocki closed 4 years ago

wtrocki commented 5 years ago

Feature Request

Package name changed to apollo-cache-persist-dev. Offix-client package needs update in package.json

AdrianJVillalobos commented 5 years ago

Hello, I would like to take this issue can you give me more details?

I'm the lead developer of @NovaHelm team, currently working on open source projects to gain experience for ourselves

wtrocki commented 5 years ago

We need to change package name in offix-client and offix-offline from apollo-cache-persist to apollo-cache-persist-dev

wtrocki commented 4 years ago

Very simple issue. Must have for 0.12.0

wtrocki commented 4 years ago

We might also check if it will be possible to use: https://morrys.github.io/wora/docs/cache-persist This package offers filtering capabilities and subscriptions

darahayes commented 4 years ago

I've been thinking about this. We now allow users to pass in their own CachePersistor instance (one is created by default if not passed). See the docs here: https://offix.dev/docs/client-configuration#cachepersistor

Perhaps we could bundle our own CachePersistor in offix client and then if users want to pass their own instance, they will use the one we export from offix-client. It could work something like this:

import {
  ApolloOfflineClient,
  CachePersistor,
  createDefaultCacheStorage
} from "offix-client";

import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";

const cache = new InMemoryCache()

const cachePersistor = new CachePersistor({
  cache,
  storage: createDefaultCacheStorage()
})

const client = new ApolloOfflineClient({
  cache,
  cachePersistor,
  link: new HttpLink({ uri: "http://example.com/graphql" });
});

What do you think?

shrey commented 4 years ago

Is this issue still relevant?

wtrocki commented 4 years ago

Good point. We actually thinking of bringing the Apollo-Cache-Perist code inside the repository so dev release is not longer needed.