mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 06:37:14 -04:00
fix: empty view id
This commit is contained in:
parent
4e2990e599
commit
b0c2b04a2d
5 changed files with 13 additions and 4 deletions
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue