mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-10-02 20:08:05 +00:00
fix: empty view id
This commit is contained in:
parent
4e2990e599
commit
b0c2b04a2d
@ -145,7 +145,7 @@ class _MobileHomePageState extends State<MobileHomePage> {
|
|||||||
|
|
||||||
void _onLatestViewChange() async {
|
void _onLatestViewChange() async {
|
||||||
final id = getIt<MenuSharedState>().latestOpenView?.id;
|
final id = getIt<MenuSharedState>().latestOpenView?.id;
|
||||||
if (id == null) {
|
if (id == null || id.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await FolderEventSetLatestView(ViewIdPB(value: id)).send();
|
await FolderEventSetLatestView(ViewIdPB(value: id)).send();
|
||||||
|
@ -36,7 +36,7 @@ class BlankPagePlugin extends Plugin {
|
|||||||
PluginWidgetBuilder get widgetBuilder => BlankPagePluginWidgetBuilder();
|
PluginWidgetBuilder get widgetBuilder => BlankPagePluginWidgetBuilder();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PluginId get id => "BlankStack";
|
PluginId get id => "";
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PluginType get pluginType => PluginType.blank;
|
PluginType get pluginType => PluginType.blank;
|
||||||
|
@ -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 view = await ViewBackendService.getView(update.parentViewId);
|
||||||
final childViews = view.fold((l) => l.childViews, (r) => []);
|
final childViews = view.fold((l) => l.childViews, (r) => []);
|
||||||
bool isSameOrder = true;
|
bool isSameOrder = true;
|
||||||
|
@ -111,6 +111,12 @@ class ViewBackendService {
|
|||||||
static Future<FlowyResult<List<ViewPB>, FlowyError>> getChildViews({
|
static Future<FlowyResult<List<ViewPB>, FlowyError>> getChildViews({
|
||||||
required String viewId,
|
required String viewId,
|
||||||
}) {
|
}) {
|
||||||
|
if (viewId.isEmpty) {
|
||||||
|
return Future.value(
|
||||||
|
FlowyResult<List<ViewPB>, FlowyError>.success(<ViewPB>[]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
final payload = ViewIdPB.create()..value = viewId;
|
final payload = ViewIdPB.create()..value = viewId;
|
||||||
|
|
||||||
return FolderEventGetView(payload).send().then((result) {
|
return FolderEventGetView(payload).send().then((result) {
|
||||||
@ -262,6 +268,9 @@ class ViewBackendService {
|
|||||||
static Future<FlowyResult<ViewPB, FlowyError>> getView(
|
static Future<FlowyResult<ViewPB, FlowyError>> getView(
|
||||||
String viewId,
|
String viewId,
|
||||||
) async {
|
) async {
|
||||||
|
if (viewId.isEmpty) {
|
||||||
|
Log.error('ViewId is empty');
|
||||||
|
}
|
||||||
final payload = ViewIdPB.create()..value = viewId;
|
final payload = ViewIdPB.create()..value = viewId;
|
||||||
return FolderEventGetView(payload).send();
|
return FolderEventGetView(payload).send();
|
||||||
}
|
}
|
||||||
|
@ -631,7 +631,7 @@ class PageNotifier extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the plugin view as the latest view.
|
// Set the plugin view as the latest view.
|
||||||
if (setLatest) {
|
if (setLatest && newPlugin.id.isNotEmpty) {
|
||||||
FolderEventSetLatestView(ViewIdPB(value: newPlugin.id)).send();
|
FolderEventSetLatestView(ViewIdPB(value: newPlugin.id)).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user