Skip to content
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

Fix instance explorer #1193

Merged
merged 1 commit into from
Mar 12, 2024
Merged

Conversation

micahmo
Copy link
Member

@micahmo micahmo commented Mar 11, 2024

Pull Request Description

This PR attempts to fix #1189. I believe the problem is less that the results are cycling endlessly, and more that we are retrieving the same page more than once, causing duplicate results, making it look like a cycle. This seems to be caused by the fact that the scroll trigger can happen multiple times in quick succession, causing the community loading to be re-entrant when we want it to complete (and emit the new page number) before loading more.

Issue Being Fixed

Issue Number: #1189

@hjiangsu
Copy link
Member

Ahh I see what's happening here. Could you do something similar to how the FeedPage does it? It checks the bloc's state to see if its currently fetching, and only calls the onScroll logic when its not in the fetching state:

This is the corresponding logic from the FeedPage:

if (
  _scrollController.position.pixels > _scrollController.position.maxScrollExtent * 0.7 &&
  context.read<FeedBloc>().state.status != FeedStatus.fetching
) {
  context.read<FeedBloc>().add(FeedFetchedEvent(
    feedTypeSubview: selectedUserOption[0] ? FeedTypeSubview.post : FeedTypeSubview.comment
  ));
}

@micahmo
Copy link
Member Author

micahmo commented Mar 12, 2024

I did that first but that state hadn't updated yet. I'm not sure why _onScroll was being called so quickly in succession, but we can't rely on the bloc to have emitted the loading state yet. Any other ideas?

@hjiangsu
Copy link
Member

Hmm, I see. I guess we can stick to the solution you have for the time being!

@hjiangsu hjiangsu merged commit b92cecc into thunder-app:develop Mar 12, 2024
1 check passed
@micahmo micahmo deleted the fix/instance-explorer branch March 12, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Community list looping in 'explore instance'
2 participants