Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: optimize recent section performance (#5948)
Lucas.Xu17c9c9b556fd
diff --git a/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dartindex 36d64e6989..07f325f6c7 100644--- a/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart@@ -1,14 +1,12 @@-import 'package:flutter/foundation.dart';-import 'package:appflowy/plugins/util.dart';import 'package:appflowy/startup/plugin/plugin.dart';import 'package:appflowy/startup/startup.dart';-import 'package:appflowy/workspace/application/recent/cached_recent_service.dart';import 'package:appflowy/workspace/application/view/view_ext.dart';import 'package:appflowy/workspace/presentation/home/home_stack.dart';import 'package:appflowy/workspace/presentation/home/menu/menu_shared_state.dart';import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';import 'package:bloc/bloc.dart';+import 'package:flutter/foundation.dart';import 'package:freezed_annotation/freezed_annotation.dart';part 'tabs_bloc.freezed.dart';@@ -92,8 +90,5 @@ class TabsBloc extends Bloc<TabsEvent, TabsState> {view: view,),);-- // Update recent views- getIt<CachedRecentService>().updateRecentViews([view.id], true);}}diff --git a/frontend/appflowy_flutter/lib/workspace/application/view_title/view_title_bar_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/view_title/view_title_bar_bloc.dartindex 35f13d3de2..45f3eebaca 100644--- a/frontend/appflowy_flutter/lib/workspace/application/view_title/view_title_bar_bloc.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/view_title/view_title_bar_bloc.dart@@ -10,19 +10,19 @@ class ViewTitleBarBloc extends Bloc<ViewTitleBarEvent, ViewTitleBarState> {ViewTitleBarBloc({required this.view,}) : super(ViewTitleBarState.initial()) {+ viewListener = ViewListener(+ viewId: view.id,+ )..start(+ onViewChildViewsUpdated: (p0) {+ add(const ViewTitleBarEvent.reload());+ },+ );+on<ViewTitleBarEvent>((event, emit) async {await event.when(initial: () async {add(const ViewTitleBarEvent.reload());-- viewListener = ViewListener(- viewId: view.id,- )..start(- onViewUpdated: (p0) {- add(const ViewTitleBarEvent.reload());- },- );},reload: () async {final List<ViewPB> ancestors =diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dartindex 7be2a4b155..43b14d9d1a 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dart@@ -143,6 +143,13 @@ class _ViewTitleState extends State<_ViewTitle> {create: (_) =>ViewTitleBloc(view: widget.view)..add(const ViewTitleEvent.initial()),child: BlocConsumer<ViewTitleBloc, ViewTitleState>(+ listenWhen: (previous, current) {+ if (previous.view == null || current.view == null) {+ return false;+ }++ return previous.view != current.view;+ },listener: (_, state) {_resetTextEditingController(state);widget.onUpdated();