Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: empty view id

Nathanb0c2b04a2da4
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 fdea8322c3..345a4591d1 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
@@ -145,7 +145,7 @@ class _MobileHomePageState extends State<MobileHomePage> {
void _onLatestViewChange() async {
final id = getIt<MenuSharedState>().latestOpenView?.id;
- if (id == null) {
+ if (id == null || id.isEmpty) {
return;
}
await FolderEventSetLatestView(ViewIdPB(value: id)).send();
diff --git a/frontend/appflowy_flutter/lib/plugins/blank/blank.dart b/frontend/appflowy_flutter/lib/plugins/blank/blank.dart
index b25bb5af06..ebda487515 100644
--- a/frontend/appflowy_flutter/lib/plugins/blank/blank.dart
+++ b/frontend/appflowy_flutter/lib/plugins/blank/blank.dart
@@ -36,7 +36,7 @@ class BlankPagePlugin extends Plugin {
PluginWidgetBuilder get widgetBuilder => BlankPagePluginWidgetBuilder();
@override
- PluginId get id => "BlankStack";
+ PluginId get id => "";
@override
PluginType get pluginType => PluginType.blank;
diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart
index 7c2a4d9b64..553317f4e4 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart
@@ -404,7 +404,7 @@ class ViewBloc extends Bloc<ViewEvent, ViewState> {
});
}
- if (update.updateChildViews.isNotEmpty) {
+ if (update.updateChildViews.isNotEmpty && update.parentViewId.isNotEmpty) {
final view = await ViewBackendService.getView(update.parentViewId);
final childViews = view.fold((l) => l.childViews, (r) => []);
bool isSameOrder = true;
diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart
index 709515f1b3..ea74f1861e 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart
@@ -111,6 +111,12 @@ class ViewBackendService {
static Future<FlowyResult<List<ViewPB>, FlowyError>> getChildViews({
required String viewId,
}) {
+ if (viewId.isEmpty) {
+ return Future.value(
+ FlowyResult<List<ViewPB>, FlowyError>.success(<ViewPB>[]),
+ );
+ }
+
final payload = ViewIdPB.create()..value = viewId;
return FolderEventGetView(payload).send().then((result) {
@@ -262,6 +268,9 @@ class ViewBackendService {
static Future<FlowyResult<ViewPB, FlowyError>> getView(
String viewId,
) async {
+ if (viewId.isEmpty) {
+ Log.error('ViewId is empty');
+ }
final payload = ViewIdPB.create()..value = viewId;
return FolderEventGetView(payload).send();
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart
index ae3b92a702..464394cd39 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart
@@ -631,7 +631,7 @@ class PageNotifier extends ChangeNotifier {
}
// Set the plugin view as the latest view.
- if (setLatest) {
+ if (setLatest && newPlugin.id.isNotEmpty) {
FolderEventSetLatestView(ViewIdPB(value: newPlugin.id)).send();
}