From 49fb0470ab70a89c8a1104278be96c3322cd250d Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Mon, 26 Sep 2022 16:54:13 +0800 Subject: [PATCH] fix: should not notify the parent node when the subtype is not changed --- .../packages/appflowy_editor/lib/src/document/node.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/document/node.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/document/node.dart index 81e87399b1..63e6525754 100644 --- a/frontend/app_flowy/packages/appflowy_editor/lib/src/document/node.dart +++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/document/node.dart @@ -93,12 +93,14 @@ class Node extends ChangeNotifier with LinkedListEntry { } void updateAttributes(Attributes attributes) { - bool shouldNotifyParent = _attributes['subtype'] != attributes['subtype']; - + final oldAttributes = {..._attributes}; _attributes = composeAttributes(_attributes, attributes) ?? {}; + // Notifies the new attributes // if attributes contains 'subtype', should notify parent to rebuild node // else, just notify current node. + bool shouldNotifyParent = + _attributes['subtype'] != oldAttributes['subtype']; shouldNotifyParent ? parent?.notifyListeners() : notifyListeners(); }