-
Notifications
You must be signed in to change notification settings - Fork 4
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
counts_by_article_type as a protobuf #921
Conversation
@@ -407,6 +409,7 @@ export async function loadPageDescriptor(newDescriptor: PageDescriptor, settings | |||
data: await data, | |||
renderedStatname: newDescriptor.statname, | |||
universe: statUniverse, | |||
counts: await counts(), |
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.
This and the await counts()
above it might fire off two calls.... either confirm the browser is smart enough to cache & combine them, or prefer one const countsResult = await counts()
above. (Naming should probably be const counts = await getCounts()
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.
Wait it's cached in the ts though right?
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.
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.
Oh missed this. In this case prefer making loadArticle
async using getCountsByArticleType()
within that function. This reduces complexity by moving code that deals with article type counts closer to where we need to care about it.
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.
For this line you can add a simple await getCountsByArticleType()
rather than needing a separate variable.
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.
StatisticPanel needs this to compute the set of universes to display, I've added a comment to this effect
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.
fixed the redundancy of counts
as a variable
Resolves #830