parse-community / ParseReact

Seamlessly bring Parse data into your React applications.
https://parseplatform.org
Other
1.3k stars 209 forks source link

Cannot read property "originalQuery" of null #168

Closed RoryCombe closed 8 years ago

RoryCombe commented 8 years ago

I'm posting this issue and what I did to resolve it in case it saves someone else some time. In a React Native project I'm working on I get the error:

Cannot read property "originalQuery" of null

simulator screen shot 26 feb 2016 12 34 53 2

This happens when mutating an object consecutively. The first mutation works, the second always fails with this error. Debugging the issue I can see that the query ParseReact is trying to update is not found within its subscriptions object and that's because my query relies on a date range. Here I had to ensure that when querying for a date range (or anything dynamic for that matter) that I specify it exactly down to the seconds and milliseconds, else ParseReact will not find it within it's subscriptions when trying to refresh queries.

"Game:kickOff,participatingTeams|[{"$gt":{"type":"Date","iso":"2016-02-25T23:00:06.079Z"},"$lt":{"type":"Date","iso":"2016-06-30T22:00:06.080Z"}}, ..."

subscriptions: {
...
Game: kickOff,participatingTeams|[{"$gt":{"__type":"Date","iso":"2016-02-25T23:00:23.865Z"},"$lt":{"__type":"Date","iso":"2016-06-30T22:00:23.865Z"}}, ...
...
}

I hope that makes sense and is of help to someone.