diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ffa7790..c86a1299 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - 帖子:修复滚动时偶现的白屏。 - 认证:修复登录页面刷新验证码时布局抖动的问题。 - 统计:修复积分统计中的积分值。 +- 分区:修复开启帖子筛选条件时,显示没有置顶帖的问题。 ### Changed diff --git a/lib/features/forum/bloc/forum_bloc.dart b/lib/features/forum/bloc/forum_bloc.dart index fd634a56..693141a9 100644 --- a/lib/features/forum/bloc/forum_bloc.dart +++ b/lib/features/forum/bloc/forum_bloc.dart @@ -143,7 +143,10 @@ class ForumBloc extends Bloc 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( document, 'tsdm_stickthread', diff --git a/lib/features/forum/bloc/forum_state.dart b/lib/features/forum/bloc/forum_state.dart index 9e73518d..d773f27f 100644 --- a/lib/features/forum/bloc/forum_state.dart +++ b/lib/features/forum/bloc/forum_state.dart @@ -106,4 +106,12 @@ class ForumState with ForumStateMappable { /// All available [FilterDateline] list. final List filterDatelineList; + + /// Check if any filter option applied on current state. + bool get hasFilter => + filterState.isFiltering() || + filterTypeList.isNotEmpty || + filterSpecialTypeList.isNotEmpty || + filterOrderList.isNotEmpty || + filterDatelineList.isNotEmpty; }