{"action":"created","issue":{"url":"https://api.github.com/repos/apollographql/react-apollo/issues/170","repository_url":"https://api.github.com/repos/apollographql/react-apollo","labels_url":"https://api.github.com/repos/apollographql/react-apollo/issues/170/labels{/name}","comments_url":"https://api.github.com/repos/apollographql/react-apollo/issues/170/comments","events_url":"https://api.github.com/repos/apollographql/react-apollo/issues/170/events","html_url":"https://github.com/apollographql/react-apollo/issues/170","id":173180034,"number":170,"title":"`loading` stuck true after variable change","user":{"login":"sgoll","id":1277035,"avatar_url":"https://avatars0.githubusercontent.com/u/1277035?v=4","gravatar_id":"","url":"https://api.github.com/users/sgoll","html_url":"https://github.com/sgoll","followers_url":"https://api.github.com/users/sgoll/followers","following_url":"https://api.github.com/users/sgoll/following{/other_user}","gists_url":"https://api.github.com/users/sgoll/gists{/gist_id}","starred_url":"https://api.github.com/users/sgoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgoll/subscriptions","organizations_url":"https://api.github.com/users/sgoll/orgs","repos_url":"https://api.github.com/users/sgoll/repos","events_url":"https://api.github.com/users/sgoll/events{/privacy}","received_events_url":"https://api.github.com/users/sgoll/received_events","type":"User","site_admin":false},"labels":[{"id":357770007,"url":"https://api.github.com/repos/apollographql/react-apollo/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":{"login":"jbaxleyiii","id":4967600,"avatar_url":"https://avatars2.githubusercontent.com/u/4967600?v=4","gravatar_id":"","url":"https://api.github.com/users/jbaxleyiii","html_url":"https://github.com/jbaxleyiii","followers_url":"https://api.github.com/users/jbaxleyiii/followers","following_url":"https://api.github.com/users/jbaxleyiii/following{/other_user}","gists_url":"https://api.github.com/users/jbaxleyiii/gists{/gist_id}","starred_url":"https://api.github.com/users/jbaxleyiii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbaxleyiii/subscriptions","organizations_url":"https://api.github.com/users/jbaxleyiii/orgs","repos_url":"https://api.github.com/users/jbaxleyiii/repos","events_url":"https://api.github.com/users/jbaxleyiii/events{/privacy}","received_events_url":"https://api.github.com/users/jbaxleyiii/received_events","type":"User","site_admin":false},"assignees":[{"login":"jbaxleyiii","id":4967600,"avatar_url":"https://avatars2.githubusercontent.com/u/4967600?v=4","gravatar_id":"","url":"https://api.github.com/users/jbaxleyiii","html_url":"https://github.com/jbaxleyiii","followers_url":"https://api.github.com/users/jbaxleyiii/followers","following_url":"https://api.github.com/users/jbaxleyiii/following{/other_user}","gists_url":"https://api.github.com/users/jbaxleyiii/gists{/gist_id}","starred_url":"https://api.github.com/users/jbaxleyiii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbaxleyiii/subscriptions","organizations_url":"https://api.github.com/users/jbaxleyiii/orgs","repos_url":"https://api.github.com/users/jbaxleyiii/repos","events_url":"https://api.github.com/users/jbaxleyiii/events{/privacy}","received_events_url":"https://api.github.com/users/jbaxleyiii/received_events","type":"User","site_admin":false}],"milestone":null,"comments":31,"created_at":"2016-08-25T11:36:18Z","updated_at":"2017-09-06T02:48:54Z","closed_at":null,"author_association":"NONE","body":"I have the following problem: when the props of my GraphQL-connected component change, and I use one of the props in the options (as variables), `loading` is stuck to the value `true` whenever both the previous value and the current value resolve to no result.\n\nHere is an example:\n\n``` js\nimport ApolloClient from 'apollo-client';\nimport gql from 'graphql-tag';\nimport React from 'react';\nimport { graphql } from 'react-apollo';\n\n// Display props.\nconst Demo = (props) => (\n  <pre>{JSON.stringify(props, null, 2)}</pre>\n);\n\n// Connect to some GraphQL query.\nconst ConnectedDemo = graphql(gql`\n  query getStuff($name: String!) {\n    stuff(name: $name) {\n      payload\n    }\n  }\n`, {\n  options: ({ name }) => ({ variables: { name } }),\n})(Demo);\n\n// Set up client.\nconst client = new ApolloClient(/* ... */);\n\nconst render = (props) => {\n  ReactDOM.render((\n    <ApolloProvider client={client}>\n      <ConnectedDemo {...props} />\n    </ApolloProvider>\n  ), document.getElementById('main'));\n};\n\n// Initial render.\nrender({\n  name: 'does-not-exist',\n});\n\n// Prop update: fetch.\nwindow.setTimeout(() => {\n  render({\n    name: 'nothing-either',\n  });\n}, 1000);\n```\n\nHere, during the initial render, everything is fine: `Demo` receives `{ loading: true, stuff: null }`. After some milliseconds, this is changed to `{ loading: false, stuff: null }`.\n\nHowever, when the prop is updated, `Demo` receives `{ loading: true, stuff: null }` and it gets stuck there, even though the network request completed as did the first one.\n\nThe problem happens with `react-apollo` version 0.4.7 as well as 0.4.6. It does not happen whenever the first fetch did return an object (i.e. `stuff` was something other than `null`).\n"},"comment":{"url":"https://api.github.com/repos/apollographql/react-apollo/issues/comments/327359272","html_url":"https://github.com/apollographql/react-apollo/issues/170#issuecomment-327359272","issue_url":"https://api.github.com/repos/apollographql/react-apollo/issues/170","id":327359272,"user":{"login":"Morphexe","id":17990387,"avatar_url":"https://avatars1.githubusercontent.com/u/17990387?v=4","gravatar_id":"","url":"https://api.github.com/users/Morphexe","html_url":"https://github.com/Morphexe","followers_url":"https://api.github.com/users/Morphexe/followers","following_url":"https://api.github.com/users/Morphexe/following{/other_user}","gists_url":"https://api.github.com/users/Morphexe/gists{/gist_id}","starred_url":"https://api.github.com/users/Morphexe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Morphexe/subscriptions","organizations_url":"https://api.github.com/users/Morphexe/orgs","repos_url":"https://api.github.com/users/Morphexe/repos","events_url":"https://api.github.com/users/Morphexe/events{/privacy}","received_events_url":"https://api.github.com/users/Morphexe/received_events","type":"User","site_admin":false},"created_at":"2017-09-06T02:48:54Z","updated_at":"2017-09-06T02:48:54Z","author_association":"NONE","body":"I am having the exact same issue here, renaming the query does not solve the issue, a full page refresh does work though."}}
{"actor":{"display_login":"Morphexe"}}