-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
useParseQuery(query) returns previous results when passed a new query #81
Comments
I posted a workaround |
@dr-skot thanks for reporting. Would be willed to open a PR with the fix as well? |
Sorry, I don't have the fix, just a workaround. I looked in the codebase to see if I could help but I'd need to spend more time than I have right now trying to grok exactly what the reducer in All my workaround does is mistrust the first response from Specifically, it returns But also this workaround isn't sufficient. There's another problem when fetching a newly created object where the 1st, 3rd, 4th, and 5th responses are wrong. Here's what I've observed, using this kind of query const query = new Parse.Query(OBJECT_CLASS).equalTo('objectId', requestedId);
const response = useParseQuery(query); When when requestId = (await new Parse.Object(OBJECT_CLASS).save()).id it's like this Maybe this is the expected behavior? I mean 1 has to be considered a bug, I think. But in 3, 4, 5 it looks like I'm getting a result from the local cache, and then in 6 the real result from the server arrives. That's cool, but I need some way to distinguish state 4 from state 6, so I don't flash NOT FOUND at the user. And all the flags are the same in states 4 and 6. Probably what's right is to remove states 1 and 4. 2 = loading ( |
FYI I've updated my workaround. It's still just a wrapper around Now I'm getting what I think is the appropriate behavior... For an object that's in the local cache, (the status column is my interpretation of what the flags mean in combination) I hope this information is helpful. Sorry it's not a PR. Maybe I'll have time to dive into the code this weekend. |
Thanks for the detailed information on the workaround. |
query
changes you getResponse (2) should be what's returned at step (1). A new query shouldn't return results from a previous one.
@parse/react-ssr 0.0.1-alpha.17
Here's a page for reproducing it:
The text was updated successfully, but these errors were encountered: