Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

On mutation safari does not refetchQueries and some other weird behavior #1859

Closed
davidalekna opened this issue Mar 28, 2018 · 1 comment
Closed

Comments

@davidalekna
Copy link

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

@davidalekna
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant