Skip to content

Commit d9ee53b

Browse files
committed
refac: placeholder performance
1 parent fa92abc commit d9ee53b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/lib/components/chat/Suggestions.svelte

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,18 @@
4242
}
4343
4444
const getFilteredPrompts = (inputValue) => {
45-
const newFilteredPrompts = inputValue.trim()
46-
? fuse.search(inputValue.trim()).map((result) => result.item)
47-
: sortedPrompts;
48-
49-
// Compare with the oldFilteredPrompts
50-
// If there's a difference, update array + version
51-
if (!arraysEqual(filteredPrompts, newFilteredPrompts)) {
52-
filteredPrompts = newFilteredPrompts;
45+
if (inputValue.length > 500) {
46+
filteredPrompts = [];
47+
} else {
48+
const newFilteredPrompts = inputValue.trim()
49+
? fuse.search(inputValue.trim()).map((result) => result.item)
50+
: sortedPrompts;
51+
52+
// Compare with the oldFilteredPrompts
53+
// If there's a difference, update array + version
54+
if (!arraysEqual(filteredPrompts, newFilteredPrompts)) {
55+
filteredPrompts = newFilteredPrompts;
56+
}
5357
}
5458
};
5559

0 commit comments

Comments
 (0)