From cfa925549e63a0e2ae93a350b32ade1b83c24cdd Mon Sep 17 00:00:00 2001 From: dom Date: Thu, 5 Feb 2026 12:26:06 +0800 Subject: [PATCH] tweaks Signed-off-by: dom --- lib/grpc/reply.dart | 13 +++++++------ lib/pages/search_panel/controller.dart | 22 ++++++++++++++++------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/lib/grpc/reply.dart b/lib/grpc/reply.dart index eb5e8e967..de680c6ef 100644 --- a/lib/grpc/reply.dart +++ b/lib/grpc/reply.dart @@ -54,11 +54,12 @@ abstract final class ReplyGrpc { oid: Int64(oid), type: Int64(type), rpid: Int64.ZERO, - cursor: CursorReq( - mode: mode, - next: cursorNext, - ), - // pagination: FeedPagination(offset: offset ?? ''), + // cursor: CursorReq( + // mode: mode, + // next: cursorNext, + // ), + mode: mode, + pagination: offset == null ? null : FeedPagination(offset: offset), ), MainListReply.fromBuffer, ); @@ -119,7 +120,7 @@ abstract final class ReplyGrpc { type: Int64(type), root: Int64(root), dialog: Int64(dialog), - pagination: FeedPagination(offset: offset ?? ''), + pagination: offset == null ? null : FeedPagination(offset: offset), ), DialogListReply.fromBuffer, ); diff --git a/lib/pages/search_panel/controller.dart b/lib/pages/search_panel/controller.dart index b2b8aee16..7155cab13 100644 --- a/lib/pages/search_panel/controller.dart +++ b/lib/pages/search_panel/controller.dart @@ -1,3 +1,5 @@ +import 'dart:async' show StreamSubscription; + import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/search.dart'; import 'package:PiliPlus/models/common/search/article_search_type.dart'; @@ -54,16 +56,18 @@ class SearchPanelController, T> onReload().whenComplete(SmartDialog.dismiss); } + StreamSubscription? _listener; + @override void onInit() { super.onInit(); try { - searchResultController = Get.find(tag: tag) - ..toTopIndex.listen((index) { - if (index == searchType.index) { - scrollController.animToTop(); - } - }); + searchResultController = Get.find(tag: tag); + _listener = searchResultController!.toTopIndex.listen((index) { + if (index == searchType.index) { + scrollController.animToTop(); + } + }); } catch (_) {} queryData(); } @@ -109,4 +113,10 @@ class SearchPanelController, T> scrollController.jumpToTop(); return super.onReload(); } + + @override + void onClose() { + _listener?.cancel(); + super.onClose(); + } }