react-apollo icon indicating copy to clipboard operation
react-apollo copied to clipboard

On mutation safari does not refetchQueries and some other weird behavior

Open d4lek opened this issue 8 years ago • 1 comments

Hi guys! I'm really struggling with this one since a few days ago. I've been testing my login mutation on different browsers, works fine on all of them except Safari. When I call my login mutation on safari it doesn't refetchQueries, a component wouldn't render and currentUser would not appear in 'account'. I also tried manually updating the cache:

  graphql(login, {
    name: 'loginMutation',
    options: {
      update: (proxy, { data: { login } }) => {
        const data = proxy.readQuery({ query: currentUser });
        data.currentUser = login;
        proxy.writeQuery({ query: currentUser, data });
      }
    }
  }),
  graphql(currentUser, { name: 'account' })

when logging componentWillReceiveProps it rerenders 3 times, with empty account, account with currentUser and then with empty account again, so it's somehow deleting the cache or something... super weird but cant figgure it out, any help would be higly appretiated!

react-apollo - 2.1.0 safari - 11.0.3 (13604.5.6)

Thanks

d4lek avatar Mar 28 '18 11:03 d4lek

specifying fetchPolicy 'cache-first' solved the issue for me.

d4lek avatar Mar 28 '18 12:03 d4lek