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.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: filter the search results by duplicate ids (#7173)
Lucas0ef1b27ae50b
diff --git a/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_settings_test.dart b/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_settings_test.dartindex 8b081c04c6..f5540b3bdc 100644--- a/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_settings_test.dart+++ b/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_settings_test.dart@@ -249,7 +249,7 @@ More actions for published page:await tester.openSettings();await tester.openSettingsPage(SettingsPage.sites);// wait the backend return the sites data- await tester.wait(1000);+ await tester.wait(2000);// check if the page is published in sites pagefinal pageItem = find.byWidgetPredicate(diff --git a/frontend/appflowy_flutter/integration_test/desktop/settings/shortcuts_settings_test.dart b/frontend/appflowy_flutter/integration_test/desktop/settings/shortcuts_settings_test.dartindex 7913a88294..af2e42c2b7 100644--- a/frontend/appflowy_flutter/integration_test/desktop/settings/shortcuts_settings_test.dart+++ b/frontend/appflowy_flutter/integration_test/desktop/settings/shortcuts_settings_test.dart@@ -35,10 +35,12 @@ void main() {await tester.pumpAndSettle();await tester.hoverOnWidget(- find.descendant(- of: find.byType(ShortcutSettingTile),- matching: find.text(backspaceCmd),- ),+ find+ .descendant(+ of: find.byType(ShortcutSettingTile),+ matching: find.text(backspaceCmd),+ )+ .first,onHover: () async {await tester.tap(find.byFlowySvg(FlowySvgs.edit_s));await tester.pumpAndSettle();@@ -85,7 +87,7 @@ void main() {as ShortcutSettingTile;expect(second.command.command,- '',+ 'backspace, shift+backspace',);});});diff --git a/frontend/appflowy_flutter/lib/workspace/application/command_palette/command_palette_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/command_palette/command_palette_bloc.dartindex 18fba61018..d952c09221 100644--- a/frontend/appflowy_flutter/lib/workspace/application/command_palette/command_palette_bloc.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/command_palette/command_palette_bloc.dart@@ -91,7 +91,7 @@ class CommandPaletteBlocemit(state.copyWith(- results: results.items,+ results: _filterDuplicates(results.items),isLoading: _messagesReceived != results.sends.toInt(),),);@@ -129,6 +129,27 @@ class CommandPaletteBloc);}+ List<SearchResultPB> _filterDuplicates(List<SearchResultPB> results) {+ final currentItems = [...state.results];+ final res = [...results];++ for (final item in results) {+ final duplicateIndex = currentItems.indexWhere((a) => a.id == item.id);+ if (duplicateIndex == -1) {+ continue;+ }++ final duplicate = currentItems[duplicateIndex];+ if (item.score < duplicate.score) {+ res.remove(item);+ } else {+ currentItems.remove(duplicate);+ }+ }++ return res..addAll(currentItems);+ }+void _performSearch(String value) =>add(CommandPaletteEvent.performSearch(search: value));