Skip to content

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.

fix view listen issue because of the notifier didn't dispose.

appflowy564af73076f8
diff --git a/frontend/app_flowy/lib/startup/tasks/application_widget.dart b/frontend/app_flowy/lib/startup/tasks/application_widget.dart
index a01d64f902..2454ca7e07 100644
--- a/frontend/app_flowy/lib/startup/tasks/application_widget.dart
+++ b/frontend/app_flowy/lib/startup/tasks/application_widget.dart
@@ -31,7 +31,7 @@ class AppWidgetTask extends LaunchTask {
supportedLocales: const [Locale('en'), Locale('zh', 'CN'), Locale('it', 'IT'), Locale('fr', 'CA')],
path: 'assets/translations',
fallbackLocale: const Locale('en'),
- child: app),
+ child: app),
);
},
blocObserver: ApplicationBlocObserver(),
@@ -56,7 +56,7 @@ class ApplicationWidget extends StatelessWidget {
value: settingModel,
builder: (context, _) {
const ratio = 1.73;
- const minWidth = 800.0;
+ const minWidth = 1000.0;
setWindowMinSize(const Size(minWidth, minWidth / ratio));
AppTheme theme = context.select<AppearanceSettingModel, AppTheme>(
(value) => value.theme,
diff --git a/frontend/app_flowy/lib/workspace/infrastructure/deps_resolver.dart b/frontend/app_flowy/lib/workspace/infrastructure/deps_resolver.dart
index 4acf2b4a13..626a2483f5 100644
--- a/frontend/app_flowy/lib/workspace/infrastructure/deps_resolver.dart
+++ b/frontend/app_flowy/lib/workspace/infrastructure/deps_resolver.dart
@@ -20,7 +20,6 @@ import 'package:app_flowy/workspace/infrastructure/repos/doc_repo.dart';
import 'package:app_flowy/workspace/infrastructure/repos/trash_repo.dart';
import 'package:app_flowy/workspace/infrastructure/repos/view_repo.dart';
import 'package:app_flowy/workspace/infrastructure/repos/workspace_repo.dart';
-import 'package:flowy_sdk/protobuf/flowy-user-data-model/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/app.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';
import 'package:get_it/get_it.dart';
diff --git a/frontend/app_flowy/lib/workspace/infrastructure/i_user_impl.dart b/frontend/app_flowy/lib/workspace/infrastructure/i_user_impl.dart
index f28dae455b..1aab9e6d02 100644
--- a/frontend/app_flowy/lib/workspace/infrastructure/i_user_impl.dart
+++ b/frontend/app_flowy/lib/workspace/infrastructure/i_user_impl.dart
@@ -86,6 +86,9 @@ class IUserListenerImpl extends IUserListener {
@override
Future<void> stop() async {
await _subscription?.cancel();
+ profileUpdatedNotifier.dispose();
+ authDidChangedNotifier.dispose();
+ workspaceUpdatedNotifier.dispose();
}
void _notificationCallback(FolderNotification ty, Either<Uint8List, FlowyError> result) {
diff --git a/frontend/app_flowy/lib/workspace/infrastructure/repos/app_repo.dart b/frontend/app_flowy/lib/workspace/infrastructure/repos/app_repo.dart
index ff642c3370..e3dc00cf6b 100644
--- a/frontend/app_flowy/lib/workspace/infrastructure/repos/app_repo.dart
+++ b/frontend/app_flowy/lib/workspace/infrastructure/repos/app_repo.dart
@@ -109,5 +109,7 @@ class AppListenerRepository {
Future<void> close() async {
await _subscription?.cancel();
+ _viewsChanged = null;
+ _update = null;
}
}
diff --git a/frontend/app_flowy/lib/workspace/infrastructure/repos/trash_repo.dart b/frontend/app_flowy/lib/workspace/infrastructure/repos/trash_repo.dart
index 8522ac693c..7cff040c90 100644
--- a/frontend/app_flowy/lib/workspace/infrastructure/repos/trash_repo.dart
+++ b/frontend/app_flowy/lib/workspace/infrastructure/repos/trash_repo.dart
@@ -72,5 +72,6 @@ class TrashListenerRepo {
Future<void> close() async {
await _subscription?.cancel();
+ _trashUpdated = null;
}
}
diff --git a/frontend/app_flowy/lib/workspace/infrastructure/repos/view_repo.dart b/frontend/app_flowy/lib/workspace/infrastructure/repos/view_repo.dart
index 7a03cf405d..1e9f02d9c7 100644
--- a/frontend/app_flowy/lib/workspace/infrastructure/repos/view_repo.dart
+++ b/frontend/app_flowy/lib/workspace/infrastructure/repos/view_repo.dart
@@ -99,5 +99,8 @@ class ViewListenerRepository {
Future<void> close() async {
await _subscription?.cancel();
+ updatedNotifier.dispose();
+ deletedNotifier.dispose();
+ restoredNotifier.dispose();
}
}
diff --git a/frontend/app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dart b/frontend/app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dart
index c027bcdfff..bea80f8d46 100644
--- a/frontend/app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dart
+++ b/frontend/app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dart
@@ -123,5 +123,7 @@ class WorkspaceListenerRepo {
Future<void> close() async {
await _subscription?.cancel();
+ _appsChanged = null;
+ _update = null;
}
}
diff --git a/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_stack_page.dart b/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_stack_page.dart
index b5fda3be0d..73cd1f961a 100644
--- a/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_stack_page.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_stack_page.dart
@@ -43,10 +43,10 @@ class DocStackContext extends HomeStackContext<int, ShareActionWrapper> {
}
@override
- Widget get leftBarItem => DocLeftBarItem(view: _view);
+ Widget get leftBarItem => DocumentLeftBarItem(view: _view);
@override
- Widget? get rightBarItem => DocShareButton(view: _view);
+ Widget? get rightBarItem => DococumentShareButton(view: _view);
@override
String get identifier => _view.id;
@@ -79,16 +79,16 @@ class DocStackContext extends HomeStackContext<int, ShareActionWrapper> {
}
}
-class DocLeftBarItem extends StatefulWidget {
+class DocumentLeftBarItem extends StatefulWidget {
final View view;
- DocLeftBarItem({required this.view, Key? key}) : super(key: ValueKey(view.hashCode));
+ DocumentLeftBarItem({required this.view, Key? key}) : super(key: ValueKey(view.hashCode));
@override
- State<DocLeftBarItem> createState() => _DocLeftBarItemState();
+ State<DocumentLeftBarItem> createState() => _DocumentLeftBarItemState();
}
-class _DocLeftBarItemState extends State<DocLeftBarItem> {
+class _DocumentLeftBarItemState extends State<DocumentLeftBarItem> {
final _controller = TextEditingController();
final _focusNode = FocusNode();
late ViewRepository repo;
@@ -147,9 +147,9 @@ class _DocLeftBarItemState extends State<DocLeftBarItem> {
}
}
-class DocShareButton extends StatelessWidget {
+class DococumentShareButton extends StatelessWidget {
final View view;
- DocShareButton({Key? key, required this.view}) : super(key: ValueKey(view.hashCode));
+ DococumentShareButton({Key? key, required this.view}) : super(key: ValueKey(view.hashCode));
@override
Widget build(BuildContext context) {
@@ -189,13 +189,11 @@ class DocShareButton extends StatelessWidget {
void _handleExportData(ExportData exportData) {
switch (exportData.exportType) {
case ExportType.Link:
- // TODO: Handle this case.
break;
case ExportType.Markdown:
FlutterClipboard.copy(exportData.data).then((value) => Log.info('copied to clipboard'));
break;
case ExportType.Text:
- // TODO: Handle this case.
break;
}
}
diff --git a/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart b/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart
index f4bf169e88..f39e13cd93 100644
--- a/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart
+++ b/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart
@@ -41,8 +41,6 @@ enum OverlapBehaviour {
stretch,
}
-// TODO: junlin - support route pop handler
-/// [Unsupported] The behavior of overlay when user tapping system back button
enum OnBackBehavior {
/// Won't handle the back action
none,
diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dispatch.dart b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dispatch.dart
index a9255a7e87..03bff83a8e 100644
--- a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dispatch.dart
+++ b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dispatch.dart
@@ -26,7 +26,6 @@ import 'package:flowy_sdk/protobuf/flowy-collaboration/protobuf.dart';
import 'package:flowy_sdk/protobuf/lib-infra/protobuf.dart';
import 'package:protobuf/protobuf.dart';
import 'dart:convert' show utf8;
-import '../protobuf/flowy-user-data-model/user_setting.pb.dart';
import 'error.dart';
part 'code_gen.dart';