fix: open the latest view when AppFlowy launch.

This commit is contained in:
appflowy 2022-07-20 20:08:42 +08:00
parent 78b756d65d
commit da3fd11737
2 changed files with 7 additions and 2 deletions

View File

@ -122,7 +122,10 @@ class _HomeScreenState extends State<HomeScreen> {
);
final latestView = workspaceSetting.hasLatestView() ? workspaceSetting.latestView : null;
getIt<MenuSharedState>().latestOpenView = latestView;
if (getIt<MenuSharedState>().latestOpenView == null) {
/// 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.
getIt<MenuSharedState>().latestOpenView = latestView;
}
return FocusTraversalGroup(child: RepaintBoundary(child: homeMenu));
}

View File

@ -164,7 +164,9 @@ class MenuSharedState {
ViewPB? get latestOpenView => _latestOpenView.value;
set latestOpenView(ViewPB? view) {
_latestOpenView.value = view;
if (_latestOpenView.value != view) {
_latestOpenView.value = view;
}
}
VoidCallback addLatestViewListener(void Function(ViewPB?) callback) {