the `this.props.data.loading` does not work someti...
# prisma-whats-new
g
the
this.props.data.loading
does not work sometimes. This has to do something with the graphcool server
1
n
@geekodour can you be more specific? What do you mean with it doesn't work? Is there an error message?
g
yes, for example if it's
this.props.data.allPosts
, on random reloads the data will show up correctly. On others it will show
this.props.data.allPosts
is
undefined
. which should never happen if
data.loading
is working correctly.
n
can you trace down the actual HTTP request/response in the case that
this.props.data.allPosts
is
undefined
? 🙂
@geekodour
g
okay, will do that with the original app and post here.
n
Thanks! You can also PM me the information if it suits you better
g
this is the console,

http://i.imgur.com/undefined.png

and the response, it's a 200 for the api http://imgur.com/a/FmClA
but the loading still fails, and on random reloads it succeeds.
n
right, so in the network tab there should be some network request
did you check that
this.props.data.loading
is
false
? 🙂
g
I did, It's working fine on the clone. I wonder why, everything is same.
Copy code
render () {
    if (this.props.data.loading) {
        return (<div>Loading</div>)
    }   
      return (
        <div>
         useful things here
        </div>
      )
  }
n
Can you PM me your project id for the project that doesn't seem to work? 🙂
And also the query itself
c
@geekodour any chance you could also send the query you use to obtain
allPosts
? it sounds like you're using Apollo client; sometimes when updating variables or manually updating the client-side cache I've seen the
data.loading
variable remain false
in my case, I had a mutation with an optimistic response that worked, but the mutation response left out a field needed for apollo to update the cache properly. when the network request came back after the mutation it would update the local cache incorrectly causing some components to break
n
Thanks @ckelley, we figured it out together. It was an inconsistency in the project setup 🙂
c
no problem!
n
But it's true, I've seen cases where
data.loading
was not behaving correctly as well. That wasn't the problem here though