From 343f7e4fd5f99e46f10b5c19038f3b9a12a36e3d Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Mon, 21 Apr 2025 17:20:35 +0800 Subject: [PATCH] Revert "fix: loading exception when switching workspace" This reverts commit 10a536b1a2e3100fa3da99ab05851702f701a3c0. --- frontend/appflowy_flutter/lib/shared/loading.dart | 6 +----- .../menu/sidebar/workspace/sidebar_workspace.dart | 11 +++-------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/frontend/appflowy_flutter/lib/shared/loading.dart b/frontend/appflowy_flutter/lib/shared/loading.dart index 3958601ed8..f8d1c6fc86 100644 --- a/frontend/appflowy_flutter/lib/shared/loading.dart +++ b/frontend/appflowy_flutter/lib/shared/loading.dart @@ -40,11 +40,7 @@ class Loading { void stop() { if (loadingContext != null) { - if (loadingContext!.mounted) { - if (Navigator.canPop(loadingContext!)) { - Navigator.of(loadingContext!).pop(); - } - } + Navigator.of(loadingContext!).pop(); loadingContext = null; } diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart index 07a5aeec4e..50ea9d83c7 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart @@ -32,10 +32,7 @@ class _SidebarWorkspaceState extends State { @override void dispose() { onHover.dispose(); - if (loadingIndicator != null) { - loadingIndicator?.stop(); - loadingIndicator = null; - } + super.dispose(); } @@ -103,10 +100,8 @@ class _SidebarWorkspaceState extends State { if (isLoading) { loadingIndicator ??= Loading(context)..start(); return; - } else if (loadingIndicator != null) { - if (mounted) { - loadingIndicator?.stop(); - } + } else { + loadingIndicator?.stop(); loadingIndicator = null; }