Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

Crash on subsequent run of multiple 'concurrent' queries #69

Closed
jBugman opened this issue Sep 9, 2019 · 1 comment · Fixed by #70
Closed

Crash on subsequent run of multiple 'concurrent' queries #69

jBugman opened this issue Sep 9, 2019 · 1 comment · Fixed by #70
Labels
bug 🐛 Oh no! A bug or unintentional behaviour.

Comments

@jBugman
Copy link

jBugman commented Sep 9, 2019

I have a page where two components run a query each, say post(postID) and comments(postID).
On the fresh page load it works fine, but on navigation with react router (then there is some previous state) page crashes (on the second query) with

client.ts:205 Uncaught (in promise) TypeError: Cannot read property 'key' of undefined
    at Client.reexecuteOperation (client.ts:205)
    at exchange.ts:134
    at Set.forEach (<anonymous>)
    at processDependencies (exchange.ts:130)
    at updateCacheWithResult (exchange.ts:218)
    at wonka.es.js:920
    at wonka.es.js:377
    at wonka.es.js:377
    at wonka.es.js:1296
    at wonka.es.js:665

At first I thought it had something to do with list<->item relationship (post list and an individual post), but then I checked that it also happen on direct post->post transition.

@jBugman jBugman changed the title Crash sequent run of multiple 'concurrent' queries Crash on subsequent run of multiple 'concurrent' queries Sep 9, 2019
@kitten
Copy link
Member

kitten commented Sep 9, 2019

I've got a tiny fix ready for this. I thought the condition that was being fixed was impossible, but it is indeed not. We've actually already encountered this issue in our default cache, but forgot to take this into account in Graphcache.

It's a really simple fix, but the problem is essentially that it's hard to reason about why this case is indeed not impossible. 😅

@kitten kitten added the bug 🐛 Oh no! A bug or unintentional behaviour. label Sep 9, 2019
@kitten kitten closed this as completed in #70 Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🐛 Oh no! A bug or unintentional behaviour.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants