From e5ad0f6d1de23fe3295b0ee3f119629e0150f53b Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Tue, 27 Aug 2024 09:23:25 +0800 Subject: [PATCH] fix: table render error (#6074) * fix: table render error * fix: sidebar doesn't refresh if the pages are same * chore: optimize empty placeholder align * fix: debounce open workspace toast * fix: editor color decoration error --- .../mobile/presentation/home/mobile_home_page.dart | 8 +++++++- .../presentation/home/shared/empty_placeholder.dart | 1 + .../plugins/document/presentation/editor_page.dart | 11 ++++++----- .../application/sidebar/space/space_bloc.dart | 5 ++++- .../home/menu/sidebar/space/sidebar_space.dart | 11 +++++++++-- frontend/appflowy_flutter/pubspec.lock | 4 ++-- frontend/appflowy_flutter/pubspec.yaml | 2 +- 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart index c3f0340953..1078d12b1f 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart @@ -177,7 +177,13 @@ class _HomePageState extends State<_HomePage> { getIt().reset(); mCurrentWorkspace.value = state.currentWorkspace; - _showResultDialog(context, state); + Debounce.debounce( + 'workspace_action_result', + const Duration(milliseconds: 150), + () { + _showResultDialog(context, state); + }, + ); }, builder: (context, state) { if (state.currentWorkspace == null) { diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/shared/empty_placeholder.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/shared/empty_placeholder.dart index 341acb8099..1b99be9a42 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/shared/empty_placeholder.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/shared/empty_placeholder.dart @@ -36,6 +36,7 @@ class EmptySpacePlaceholder extends StatelessWidget { lineHeight: 1.3, color: Theme.of(context).hintColor, ), + const VSpace(kBottomNavigationBarHeight + 36.0), ], ), ); diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart index 731a0b6d6d..53dbf57c6d 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart @@ -499,11 +499,12 @@ class _AppFlowyEditorPageState extends State { } void _customizeBlockComponentBackgroundColorDecorator() { - if (!context.mounted) { - return; - } - blockComponentBackgroundColorDecorator = (Node node, String colorString) => - buildEditorCustomizedColor(context, node, colorString); + blockComponentBackgroundColorDecorator = (Node node, String colorString) { + if (context.mounted) { + return buildEditorCustomizedColor(context, node, colorString); + } + return null; + }; } void _initEditorL10n() => AppFlowyEditorL10n.current = EditorI18n(); diff --git a/frontend/appflowy_flutter/lib/workspace/application/sidebar/space/space_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/sidebar/space/space_bloc.dart index feef136206..41ef345755 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/sidebar/space/space_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/sidebar/space/space_bloc.dart @@ -559,7 +559,10 @@ class SpaceBloc extends Bloc { return true; } - final viewId = fixedUuid(user.id.toInt(), UuidType.publicSpace); + final viewId = fixedUuid( + user.id.toInt() + (_workspaceId?.hashCode ?? 0), + UuidType.publicSpace, + ); final publicSpace = await _createSpace( name: 'Shared', icon: builtInSpaceIcons.first, diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/sidebar_space.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/sidebar_space.dart index e7ca76e533..288f42c064 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/sidebar_space.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/sidebar_space.dart @@ -3,6 +3,7 @@ import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/workspace/application/favorite/favorite_bloc.dart'; import 'package:appflowy/workspace/application/sidebar/space/space_bloc.dart'; import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart'; +import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart'; import 'package:appflowy/workspace/presentation/home/hotkeys.dart'; import 'package:appflowy/workspace/presentation/home/menu/menu_shared_state.dart'; import 'package:appflowy/workspace/presentation/home/menu/sidebar/favorites/favorite_folder.dart'; @@ -31,7 +32,6 @@ class SidebarSpace extends StatelessWidget { @override Widget build(BuildContext context) { - // const sectionPadding = 16.0; return ValueListenableBuilder( valueListenable: getIt().notifier, builder: (context, value, child) { @@ -89,6 +89,8 @@ class _SpaceState extends State<_Space> { @override Widget build(BuildContext context) { + final currentWorkspace = + context.watch().state.currentWorkspace; return BlocBuilder( builder: (context, state) { if (state.spaces.isEmpty) { @@ -115,7 +117,12 @@ class _SpaceState extends State<_Space> { onEnter: (_) => isHovered.value = true, onExit: (_) => isHovered.value = false, child: SpacePages( - key: ValueKey(currentSpace.id), + key: ValueKey( + Object.hashAll([ + currentWorkspace?.workspaceId ?? '', + currentSpace.id, + ]), + ), isExpandedNotifier: isExpandedNotifier, space: currentSpace, isHovered: isHovered, diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lock index 267fb80c21..04e83c0bcc 100644 --- a/frontend/appflowy_flutter/pubspec.lock +++ b/frontend/appflowy_flutter/pubspec.lock @@ -53,8 +53,8 @@ packages: dependency: "direct main" description: path: "." - ref: "8e17d14" - resolved-ref: "8e17d1447eea0b57ff92e31dbe88796ce759fb37" + ref: a64a516 + resolved-ref: a64a5165e79bd2424e594b793843a7158e7d4fb4 url: "https://github.com/AppFlowy-IO/appflowy-editor.git" source: git version: "3.2.0" diff --git a/frontend/appflowy_flutter/pubspec.yaml b/frontend/appflowy_flutter/pubspec.yaml index 278b5bd187..a02263011a 100644 --- a/frontend/appflowy_flutter/pubspec.yaml +++ b/frontend/appflowy_flutter/pubspec.yaml @@ -190,7 +190,7 @@ dependency_overrides: appflowy_editor: git: url: https://github.com/AppFlowy-IO/appflowy-editor.git - ref: "8e17d14" + ref: "a64a516" appflowy_editor_plugins: git: