convoyinc / apollo-cache-hermes

A cache implementation for Apollo Client, tuned for performance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding more descriptive logging for InvalidPayloadError

iangbuck opened this issue · comments

Idea:

More descriptive error logging when encountering mismatch between query and fragments.

Screen Shot 2019-06-17 at 6 33 48 PM

This error came up when a query had not included an id value for a sub entity on a "shipment" entity, but the fragments did. In the repository I was working in shipment is the most common entity, so this error message was practically useless in tracking down the issue. Including the specific fragment / query name that triggered the error would greatly ease debugging.

Yeah :( The challenge around this one is that we can't realistically identify which queries touched a specific path in the cache without adding a ton of overhead; the query that gets the error may be triggeirng off a change made by one that ran many many queries in the past.

I think we may want to invest in getting #311 (comment) past the finish line (but it's been hard to make time for that)

FYI, I recently updated versions of dependencies, including this project, and I now see InvalidPayloadError when I didn't before. So, I'm also interested in #311 (comment)

Solved my issue by knowing payload and previousValue via console.log so this logging will be helpful.