Use sticker body for searching (#1347)
authorgreentore <117551249+greentore@users.noreply.github.com>
Sun, 23 Jul 2023 08:11:36 +0000 (10:11 +0200)
committerGitHub <noreply@github.com>
Sun, 23 Jul 2023 08:11:36 +0000 (13:41 +0530)
src/app/components/emoji-board/EmojiBoard.tsx

index 4005234adb14a39a686a39ab020812e2b7facb0c..76c6f05dda4d59716e929cf0ca2ddc8de4aecb94 100644 (file)
@@ -598,7 +598,13 @@ export const NativeEmojiGroups = memo(
   )
 );
 
-const getSearchListItemStr = (item: ExtendedPackImage | IEmoji) => `:${item.shortcode}:`;
+const getSearchListItemStr = (item: ExtendedPackImage | IEmoji) => {
+  const shortcode = `:${item.shortcode}:`;
+  if ('body' in item) {
+    return [shortcode, item.body ?? ''];
+  }
+  return shortcode;
+};
 const SEARCH_OPTIONS: UseAsyncSearchOptions = {
   limit: 26,
   matchOptions: {