Skip to content

Commit b3f94be

Browse files
committed
fix: filter out the space when opening new tab (#7152)
* fix: filter out the space when opening tab * test: filter out the space when opening tab
1 parent ace3985 commit b3f94be

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:appflowy/user/application/user_listener.dart';
2+
import 'package:appflowy/workspace/application/view/view_ext.dart';
23
import 'package:appflowy_backend/log.dart';
34
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
45
import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'
@@ -48,10 +49,17 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
4849
emit(state.copyWith(isLoading: e.isLoading));
4950
},
5051
didReceiveWorkspaceSetting: (_DidReceiveWorkspaceSetting value) {
52+
// the latest view is shared across all the members of the workspace.
53+
5154
final latestView = value.setting.hasLatestView()
5255
? value.setting.latestView
5356
: state.latestView;
5457

58+
if (latestView != null && latestView.isSpace) {
59+
// If the latest view is a space, we don't need to open it.
60+
return;
61+
}
62+
5563
emit(
5664
state.copyWith(
5765
workspaceSetting: value.setting,

frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ class TabsBloc extends Bloc<TabsEvent, TabsState> {
6565
state.currentPageManager.hideSecondaryPlugin();
6666
emit(state.openPlugin(plugin: plugin, setLatest: setLatest));
6767
if (setLatest) {
68+
// the space view should be filtered out.
69+
if (view != null && view.isSpace) {
70+
return;
71+
}
6872
_setLatestOpenView(view);
6973
}
7074
},

0 commit comments

Comments
 (0)