-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fixes #13246 - Add checks for empty annotations #13422
Conversation
@@ -30,7 +30,7 @@ export default (req, panel) => { | |||
return bodies; | |||
}); | |||
|
|||
if (!bodies.length) return { responses: [] }; | |||
if (!bodies.length) return Promise.resolve({ responses: [] }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while we're in here anyway, consider flagging the get_annotations
function as async
instead. it avoids boilerplate like this and babel will give us some more compile-time safety. not sure how far this will cascade though....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored this file to use async/await
This PR fixes #13246 by adding a check to make sure there are actual annotations in the annotations array. It also returns a promise for
getAnnotations()
instead of just an object when request is empty due to the lack of any valid annotations.