fix in-thread search. (#294)

This commit is contained in:
Jojo Feng
2023-11-02 14:51:46 -07:00
committed by GitHub
parent 3ee60e1a44
commit 939d55ef0d
3 changed files with 5 additions and 1 deletions

View File

@ -113,6 +113,8 @@ class CommentsCubit extends Cubit<CommentsState> {
state.copyWith(
status: CommentsStatus.inProgress,
comments: <Comment>[],
matchedComments: <int>[],
inThreadSearchQuery: '',
currentPage: 0,
),
);

View File

@ -141,6 +141,7 @@ class _InThreadSearchViewState extends State<_InThreadSearchView> {
children: <Widget>[
for (final int i in state.matchedComments)
CommentTile(
index: i,
comment: state.comments.elementAt(i),
fetchMode: FetchMode.lazy,
actionable: false,

View File

@ -359,7 +359,8 @@ class CommentTile extends StatelessWidget {
final CollapseState collapseState = context.read<CollapseCubit>().state;
final CommentsState? commentsState =
context.tryRead<CommentsCubit>()?.state;
return fetchMode == FetchMode.lazy &&
return actionable &&
fetchMode == FetchMode.lazy &&
comment.kids.isNotEmpty &&
collapseState.collapsed == false &&
commentsState?.commentIds.contains(comment.kids.first) == false &&