diff --git a/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/tabs_test.dart b/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/tabs_test.dart index e79a72d931..5c07d99afa 100644 --- a/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/tabs_test.dart +++ b/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/tabs_test.dart @@ -1,4 +1,5 @@ import 'package:appflowy/env/cloud_env.dart'; +import 'package:appflowy/plugins/document/presentation/editor_page.dart'; import 'package:appflowy/shared/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'; @@ -71,5 +72,16 @@ void main() { expect(find.byType(FlowyTab), findsNothing); }); + + testWidgets('the space view should not be opened', (tester) async { + await tester.initializeAppFlowy( + cloudType: AuthenticatorType.appflowyCloudSelfHost, + ); + await tester.tapGoogleLoginInButton(); + await tester.expectToSeeHomePageWithGetStartedPage(); + + expect(find.byType(AppFlowyEditorPage), findsNothing); + expect(find.text('Blank page'), findsOne); + }); }); } diff --git a/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart index 2fb801595c..1afc253ab7 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart @@ -1,4 +1,5 @@ import 'package:appflowy/user/application/user_listener.dart'; +import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart' @@ -48,10 +49,17 @@ class HomeBloc extends Bloc { emit(state.copyWith(isLoading: e.isLoading)); }, didReceiveWorkspaceSetting: (_DidReceiveWorkspaceSetting value) { + // the latest view is shared across all the members of the workspace. + final latestView = value.setting.hasLatestView() ? value.setting.latestView : state.latestView; + if (latestView != null && latestView.isSpace) { + // If the latest view is a space, we don't need to open it. + return; + } + emit( state.copyWith( workspaceSetting: value.setting, diff --git a/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart index d2ef7cfc74..1a9af7c028 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart @@ -70,6 +70,10 @@ class TabsBloc extends Bloc { ..setSecondaryPlugin(BlankPagePlugin()); emit(state.openPlugin(plugin: plugin, setLatest: setLatest)); if (setLatest) { + // the space view should be filtered out. + if (view != null && view.isSpace) { + return; + } _setLatestOpenView(view); } },