Skip to content

Commit

Permalink
fix(forum): Fix empty pinned thread when filtering thread
Browse files Browse the repository at this point in the history
  • Loading branch information
realth000 committed Aug 18, 2024
1 parent 887d049 commit 0dff03f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- 帖子:修复滚动时偶现的白屏。
- 认证:修复登录页面刷新验证码时布局抖动的问题。
- 统计:修复积分统计中的积分值。
- 分区:修复开启帖子筛选条件时,显示没有置顶帖的问题。

### Changed

Expand Down
5 changes: 4 additions & 1 deletion lib/features/forum/bloc/forum_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ class ForumBloc extends Bloc<ForumEvent, ForumState> with LoggerMixin {
// When jump to other pages, pinned thread and subreddits should be
// reserved in state.
// Only the first page has pinned threads and subreddits.
if (pageNumber == 1) {
//
// If any filter options applied on current state, ignore the pinned thread
// result in fetched dom because none may found.
if (pageNumber == 1 && !state.hasFilter) {
stickThreadList = _buildThreadList<StickThread>(
document,
'tsdm_stickthread',
Expand Down
8 changes: 8 additions & 0 deletions lib/features/forum/bloc/forum_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,12 @@ class ForumState with ForumStateMappable {

/// All available [FilterDateline] list.
final List<FilterDateline> filterDatelineList;

/// Check if any filter option applied on current state.
bool get hasFilter =>
filterState.isFiltering() ||
filterTypeList.isNotEmpty ||
filterSpecialTypeList.isNotEmpty ||
filterOrderList.isNotEmpty ||
filterDatelineList.isNotEmpty;
}

0 comments on commit 0dff03f

Please sign in to comment.