Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throws exception when clearing a cached result of null #2

Open
dallonf opened this issue May 30, 2017 · 3 comments
Open

Throws exception when clearing a cached result of null #2

dallonf opened this issue May 30, 2017 · 3 comments

Comments

@dallonf
Copy link

dallonf commented May 30, 2017

When one of my patterns matches a path in the store that has a value of null, I get this error:

apollo.umd.js:1508 TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at isReference (webpack:///./~/apollo-cache-invalidation/lib/index.js?:42:17)
    at Object.findMatches (webpack:///./~/apollo-cache-invalidation/lib/index.js?:64:9)
    at Object.eval (webpack:///./~/traverse/index.js?:59:22)
    at walker (webpack:///./~/traverse/index.js?:190:22)
    at eval (webpack:///./~/traverse/index.js?:208:29)
    at Array.forEach (native)
    at forEach (webpack:///./~/traverse/index.js?:298:31)
    at walker (webpack:///./~/traverse/index.js?:203:13)
    at eval (webpack:///./~/traverse/index.js?:208:29)

Looks like the problem is that findMatches assumes that this.node is an object and not null.

@lucasconstantino
Copy link
Owner

Could you work on a pull-request?

@dallonf
Copy link
Author

dallonf commented May 31, 2017

Unfortunately I don't have a lot of time right now and I was able to find a workaround that was actually probably a better choice in my particular scenario (instead of invalidating that particular part of the cache, I called writeQuery to populate it since I had the data that should go there available) Sorry :(

@lucasconstantino
Copy link
Owner

Thanks for pointing out the bug ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants