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
fix: close other tabs before switching workspace (#6830)
Lucasa0d8711d5cc6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex dc9e7bc897..fbec9204a4 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,4 +1,16 @@# Release Notes+# Release Notes+## Version 0.7.4 - 19/11/2024+### New Features+- Support uploading WebP and BMP images+- Support managing workspaces on mobile+- Support adding toggle headings on mobile+- Improve the AI chat page UI+### Bug Fixes+- Optimized the workspace menu loading performance+- Optimized tab switching performance+- Fixed searching issues in Document page+## Version 0.7.3 - 07/11/2024### New Features- Enable custom URLs for published pagesdiff --git a/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/tabs_test.dart b/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/tabs_test.dartnew file mode 100644index 0000000000..6661075878--- /dev/null+++ b/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/tabs_test.dart@@ -0,0 +1,75 @@+import 'package:appflowy/env/cloud_env.dart';+import 'package:appflowy/plugins/document/presentation/editor_plugins/openai/widgets/loading.dart';+import 'package:appflowy/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart';+import 'package:appflowy/workspace/presentation/home/tabs/flowy_tab.dart';+import 'package:appflowy/workspace/presentation/home/tabs/tabs_manager.dart';+import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:integration_test/integration_test.dart';++import '../../../shared/constants.dart';+import '../../../shared/util.dart';++void main() {+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();++ group('Tabs', () {+ testWidgets('close other tabs before opening a new workspace',+ (tester) async {+ await tester.initializeAppFlowy(+ cloudType: AuthenticatorType.appflowyCloudSelfHost,+ );+ await tester.tapGoogleLoginInButton();+ await tester.expectToSeeHomePageWithGetStartedPage();++ const name = 'AppFlowy.IO';+ // the workspace will be opened after created+ await tester.createCollaborativeWorkspace(name);++ final loading = find.byType(Loading);+ await tester.pumpUntilNotFound(loading);++ // create new tabs in the workspace+ expect(find.byType(FlowyTab), findsNothing);++ const documentOneName = 'document one';+ const documentTwoName = 'document two';+ await tester.createNewPageInSpace(+ spaceName: Constants.generalSpaceName,+ layout: ViewLayoutPB.Document,+ pageName: documentOneName,+ );+ await tester.createNewPageInSpace(+ spaceName: Constants.generalSpaceName,+ layout: ViewLayoutPB.Document,+ pageName: documentTwoName,+ );++ /// Open second menu item in a new tab+ await tester.openAppInNewTab(documentOneName, ViewLayoutPB.Document);++ /// Open third menu item in a new tab+ await tester.openAppInNewTab(documentTwoName, ViewLayoutPB.Document);++ expect(+ find.descendant(+ of: find.byType(TabsManager),+ matching: find.byType(FlowyTab),+ ),+ findsNWidgets(2),+ );++ // switch to the another workspace+ final Finder items = find.byType(WorkspaceMenuItem);+ await tester.openCollaborativeWorkspaceMenu();+ await tester.pumpUntilFound(items);+ expect(items, findsNWidgets(2));++ // open the first workspace+ await tester.tap(items.first);+ await tester.pumpUntilNotFound(loading);++ expect(find.byType(FlowyTab), findsNothing);+ });+ });+}diff --git a/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_test_runner.dart b/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_test_runner.dartindex 8ed85e467d..4d2862038e 100644--- a/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_test_runner.dart+++ b/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_test_runner.dart@@ -3,6 +3,7 @@ import 'package:integration_test/integration_test.dart';import 'change_name_and_icon_test.dart' as change_name_and_icon_test;import 'collaborative_workspace_test.dart' as collaborative_workspace_test;import 'share_menu_test.dart' as share_menu_test;+import 'tabs_test.dart' as tabs_test;import 'workspace_icon_test.dart' as workspace_icon_test;import 'workspace_settings_test.dart' as workspace_settings_test;@@ -14,4 +15,5 @@ void main() {collaborative_workspace_test.main();change_name_and_icon_test.main();workspace_icon_test.main();+ tabs_test.main();}diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dartindex 4119239694..fc3c53e260 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart@@ -3,6 +3,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart';import 'package:appflowy/generated/locale_keys.g.dart';import 'package:appflowy/startup/startup.dart';import 'package:appflowy/user/application/auth/auth_service.dart';+import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart';import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';import 'package:appflowy/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_actions.dart';import 'package:appflowy/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_icon.dart';@@ -297,12 +298,16 @@ class _WorkspaceInfo extends StatelessWidget {void _openWorkspace(BuildContext context) {if (!isSelected) {+ // close the other tabs before opening another workspace.+ getIt<TabsBloc>().add(const TabsEvent.closeOtherTabs(''));+Log.info('open workspace: ${workspace.workspaceId}');context.read<UserWorkspaceBloc>().add(UserWorkspaceEvent.openWorkspace(workspace.workspaceId,),);+PopoverContainer.of(context).closeAll();}}