Skip to content

Commit

Permalink
fix: filter out the space when opening new tab (#7152)
Browse files Browse the repository at this point in the history
* fix: filter out the space when opening tab

* test: filter out the space when opening tab
  • Loading branch information
LucasXu0 committed Jan 6, 2025
1 parent ace3985 commit b3f94be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -48,10 +49,17 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class TabsBloc extends Bloc<TabsEvent, TabsState> {
state.currentPageManager.hideSecondaryPlugin();
emit(state.openPlugin(plugin: plugin, setLatest: setLatest));
if (setLatest) {
// the space view should be filtered out.
if (view != null && view.isSpace) {
return;
}
_setLatestOpenView(view);
}
},
Expand Down

0 comments on commit b3f94be

Please sign in to comment.