apollo-link-logger
apollo-link-logger copied to clipboard
Look through definitions to find an operation type
Why It's weird that often the link logs with undefined type
What:
For documents with queries and fragment definitions, often I was noticing that the operation type was reported as undefined.
The root cause is that we were looking at the first definition in the query, which in our app is often a Fragment Definition instead of an Operation Definition and so doesn't have an operationType (query/mutation etc).
So instead since most documents have a single operation, I'm trying to find and report its operationType instead of looking only at the first definition.
How: This change simply looks through to find one that isn't undefined. It's still picking one from an array, but I think this is generally going to give better results than the previous heuristic of taking the first.
Checklist:
- [x] Documentation N/A
- [x] Tests N/A
- [x] Ready to be merged
- [x] Added myself to contributors table
There were the following issues with this Pull Request
- Commit: 08100b54387ea8fdcbdc9e5e25e5c7bd1a16b1fd
- ✖ message may not be empty
- ✖ type may not be empty
You may need to change the commit messages to comply with the repository contributing guidelines.
🤖 This comment was generated by commitlint[bot]. Please report issues here.
Happy coding!
Hi - I just checked back on this because I'm still a bit frustrated by the undefined
showing up in my logs all the time.
Any feedback on this PR? Can a maintainer help me understand what more I would need to do to get this merged?
Please note that I've already corrected the issues identified by commitlint.