nhost / nhost-dart

Nhost Dart & Flutter packages

Home Page:https://nhost.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NhostGraphQLProvider cache

MichalNemec opened this issue · comments

Hello,

Based on the graphql_flutter, there is setting for cache, is it handled automatically or the setting is just missing?

// We're using HiveStore for persistence,
  // so we need to initialize Hive.
  await initHiveForFlutter();

....

  ValueNotifier<GraphQLClient> client = ValueNotifier(
    GraphQLClient(
      link: link,
      // The default store is the InMemoryStore, which does NOT persist to disk
      cache: GraphQLCache(store: HiveStore()),
    ),
  );

Hey @MichalNemec!

This is what's used internally by the NhostGraphQLProvider:

GraphQLClient createNhostGraphQLClientForAuth(

It uses the default GraphQLCache with the default InMemoryStore which doesn't persist anything to the disk. We are not exposing this field through the provider, so you won't be able to change the type of the cache or the store at the moment.

Unfortunately I don't see any possible workarounds, so we'll need to fix this to let you configure the cache.

Hey @MichalNemec!

This is what's used internally by the NhostGraphQLProvider:

GraphQLClient createNhostGraphQLClientForAuth(

It uses the default GraphQLCache with the default InMemoryStore which doesn't persist anything to the disk. We are not exposing this field through the provider, so you won't be able to change the type of the cache or the store at the moment.

Unfortunately I don't see any possible workarounds, so we'll need to fix this to let you configure the cache.

You are golden, thank you very much, ill wait for the cache update

I'm closing this issue, because the cache is already configurable through NhostGraphQLProvider. Thanks again @MichalNemec! 🙌🏼