From 8eb14007be428c24b4e5eecc3a19fe43f0f1304a Mon Sep 17 00:00:00 2001 From: Mathias Mogensen <42929161+Xazin@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:32:47 +0200 Subject: [PATCH] fix: only notify ui of selection change if it actually changed (#914) --- .../service/selection/desktop_selection_service.dart | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/src/editor/editor_component/service/selection/desktop_selection_service.dart b/lib/src/editor/editor_component/service/selection/desktop_selection_service.dart index bc5e303fa..915586370 100644 --- a/lib/src/editor/editor_component/service/selection/desktop_selection_service.dart +++ b/lib/src/editor/editor_component/service/selection/desktop_selection_service.dart @@ -1,9 +1,10 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:appflowy_editor/src/editor/editor_component/service/selection/mobile_selection_service.dart'; import 'package:appflowy_editor/src/editor/editor_component/service/selection/shared.dart'; import 'package:appflowy_editor/src/service/selection/selection_gesture.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; class DesktopSelectionServiceWidget extends StatefulWidget { @@ -333,7 +334,10 @@ class _DesktopSelectionServiceWidgetState final start = _panStartPosition!; final end = last.getSelectionInRange(panStartOffset, panEndOffset).end; final selection = Selection(start: start, end: end); - updateSelection(selection); + + if (selection != currentSelection.value) { + updateSelection(selection); + } } editorState.service.scrollService?.startAutoScroll(