mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-10-31 01:54:37 +00:00 
			
		
		
		
	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
This commit is contained in:
		
							parent
							
								
									91236006d4
								
							
						
					
					
						commit
						a33cf1f488
					
				| @ -1,4 +1,5 @@ | |||||||
| import 'package:appflowy/env/cloud_env.dart'; | 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/shared/loading.dart'; | ||||||
| import 'package:appflowy/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.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/flowy_tab.dart'; | ||||||
| @ -71,5 +72,16 @@ void main() { | |||||||
| 
 | 
 | ||||||
|       expect(find.byType(FlowyTab), findsNothing); |       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); | ||||||
|  |     }); | ||||||
|   }); |   }); | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| import 'package:appflowy/user/application/user_listener.dart'; | 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/log.dart'; | ||||||
| import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; | import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; | ||||||
| import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart' | import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart' | ||||||
| @ -48,10 +49,17 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> { | |||||||
|             emit(state.copyWith(isLoading: e.isLoading)); |             emit(state.copyWith(isLoading: e.isLoading)); | ||||||
|           }, |           }, | ||||||
|           didReceiveWorkspaceSetting: (_DidReceiveWorkspaceSetting value) { |           didReceiveWorkspaceSetting: (_DidReceiveWorkspaceSetting value) { | ||||||
|  |             // the latest view is shared across all the members of the workspace. | ||||||
|  | 
 | ||||||
|             final latestView = value.setting.hasLatestView() |             final latestView = value.setting.hasLatestView() | ||||||
|                 ? value.setting.latestView |                 ? value.setting.latestView | ||||||
|                 : state.latestView; |                 : state.latestView; | ||||||
| 
 | 
 | ||||||
|  |             if (latestView != null && latestView.isSpace) { | ||||||
|  |               // If the latest view is a space, we don't need to open it. | ||||||
|  |               return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             emit( |             emit( | ||||||
|               state.copyWith( |               state.copyWith( | ||||||
|                 workspaceSetting: value.setting, |                 workspaceSetting: value.setting, | ||||||
|  | |||||||
| @ -70,6 +70,10 @@ class TabsBloc extends Bloc<TabsEvent, TabsState> { | |||||||
|               ..setSecondaryPlugin(BlankPagePlugin()); |               ..setSecondaryPlugin(BlankPagePlugin()); | ||||||
|             emit(state.openPlugin(plugin: plugin, setLatest: setLatest)); |             emit(state.openPlugin(plugin: plugin, setLatest: setLatest)); | ||||||
|             if (setLatest) { |             if (setLatest) { | ||||||
|  |               // the space view should be filtered out. | ||||||
|  |               if (view != null && view.isSpace) { | ||||||
|  |                 return; | ||||||
|  |               } | ||||||
|               _setLatestOpenView(view); |               _setLatestOpenView(view); | ||||||
|             } |             } | ||||||
|           }, |           }, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Lucas
						Lucas