File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
frontend/app_flowy/lib/workspace/presentation/home Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -144,11 +144,24 @@ class _HomeScreenState extends State<HomeScreen> {
144144 collapsedNotifier: getIt <HomeStackManager >().collapsedNotifier,
145145 );
146146
147- final latestView =
148- workspaceSetting.hasLatestView () ? workspaceSetting.latestView : null ;
149- if (getIt <MenuSharedState >().latestOpenView == null ) {
150- /// AppFlowy will open the view that the last time the user opened it. The _buildHomeMenu will get called when AppFlowy's screen resizes. So we only set the latestOpenView when it's null.
151- getIt <MenuSharedState >().latestOpenView = latestView;
147+ // Only open the last opened view if the [HomeStackManager] current opened
148+ // plugin is blank and the last opened view is not null.
149+ //
150+ // All opened widgets that display on the home screen are in the form
151+ // of plugins. There is a list of built-in plugins defined in the
152+ // [PluginType] enum, including board, grid and trash.
153+
154+ if (getIt <HomeStackManager >().plugin.ty == PluginType .blank) {
155+ // Open the last opened view.
156+ if (workspaceSetting.hasLatestView ()) {
157+ final view = workspaceSetting.latestView;
158+ final plugin = makePlugin (
159+ pluginType: view.pluginType,
160+ data: view,
161+ );
162+ getIt <HomeStackManager >().setPlugin (plugin);
163+ getIt <MenuSharedState >().latestOpenView = view;
164+ }
152165 }
153166
154167 return FocusTraversalGroup (child: RepaintBoundary (child: homeMenu));
Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ class HomeStackManager {
144144 }
145145
146146 PublishNotifier <bool > get collapsedNotifier => _notifier.collapsedNotifier;
147+ Plugin get plugin => _notifier.plugin;
147148
148149 void setPlugin (Plugin newPlugin) {
149150 _notifier.plugin = newPlugin;
You can’t perform that action at this time.
0 commit comments