Skip to content

React Native: Response not successful #13

@danilowoz

Description

@danilowoz

Hey, nice to see this elegant solution for persisting data, but I'm facing some issue on React Native implementation.

My Apollo client configuration:

  import AsyncStorage from '@react-native-community/async-storage';

  const cache = new InStorageCache({
    addPersistField: true,
    shouldPersist: PersistLink.shouldPersist,
    storage: AsyncStorage,
    denormalize: async result => {
      const data = await result;
      return JSON.parse(data);
    },
  });

  const link = ApolloLink.from([
    new PersistLink(),
    createHttpLink({ uri: API }),
  ]);

  const client = new ApolloClient({
    cache,
    link,
  });

Problem:
On the first query, I'm not using the directive @persist, then I'm getting the following message on the simulator:

Screenshot 2020-02-06 at 17 28 46

And even if I add the directive, it still doesn't save the data.
Any idea about it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions