Repository navigation
Conversation
fregante
commented
Jul 19, 2022
| issues(states: OPEN) { | ||
| totalCount | ||
| } | ||
| const labels = await api.v4repository(` |
Member
Author
There was a problem hiding this comment.
First feature first bug found. 😅 I made the same mistake in many places.
Have not reviewed yet.
Suggested change
| const labels = await api.v4repository(` | |
| const {labels} = await api.v4repository(` |
| const {owner, name} = getRepo()!; | ||
| const {repository, organization} = await api.v4(` | ||
| repository() { | ||
| repository(owner: "${owner}", name: "${name}") { |
Member
Author
There was a problem hiding this comment.
This is the only exception. The solution is not bad.
| return ` | ||
| repository() { | ||
| ${issueIds.map(id => ` | ||
| return issueIds.map(id => ` |
Member
Author
There was a problem hiding this comment.
This is the nice side effect: no more awkward array map inside template literal
This was referenced Jul 20, 2022
Member
Author
|
Closing in favor of a more proper solution #5848 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fix for the issue above is rather easy: change
api.v4’scacheKeyto include the repo as well as its parameters.However I didn't think about that until I was half-way through this, and thought it was still worth the simplification.
Every single v4 call using
repository()(except one) only queriedrepository(), so it made sense to wrap that into a specific helper instead of having a replaceablerepository() {string. This has the nice side effect that we skip some awkward template strings we had to use. Example belowUntested, quick search and replace. Must be reviewed without whitespace.