-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add gate to increase post-feed page size #5473
Conversation
|
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's more logic that uses PAGE_SIZE
— notably, the logic that ensures we have enough posts fetched in cases some of them get filtered out. i think you probably want to adjust that logic too.
i would suggest just removing the PAGE_SIZE
constant altogether so that we're not tempted to use it accidentally.
@gaearon right right, I should have explained this better or named things better. My thinking is is that we have two numbers here: the min number of posts we want to fill a screen (rn it's 30), and the fetch limit. That fetch limit is what I think we need to bump here, because that will ensure that we fill at least 30 posts for the view. If we increase the min posts we want to 100, we'll be doing likely about the same number of requests, and each request is now heavier than before. That sound reasonable? My latest commit adds some clarification, good call on not wanting to confuse the const. |
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.
ah ok thanks for explaining, makes sense
src/state/queries/post-feed.ts
Outdated
*/ | ||
const fetchLimit = React.useState(() => { | ||
return gate('post_feed_lang_window') ? 100 : MIN_POSTS | ||
})[0] |
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 can just be
const fetchLimit = gate('post_feed_lang_window') ? 100 : MIN_POSTS
because gates are cached per-user in memory
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.
Ah right, thanks!
Feeds that don't do language filtering themselves return all results to the client, where we do our best to filter by the user's
contentLanguages
. If we get no good results back, we "bail out" and return the raw results, which may all be in a different language.This PR adds a flag so we can test upping this fetch limit to see if that improves how many posts we get back in the user's language.