mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
search_suggestion: Convert prev from object to Set.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
e848bc2a21
commit
bf0a3d9d14
@@ -582,7 +582,7 @@ function get_operator_suggestions(last) {
|
|||||||
function make_attacher(base) {
|
function make_attacher(base) {
|
||||||
const self = {};
|
const self = {};
|
||||||
self.result = [];
|
self.result = [];
|
||||||
const prev = {};
|
const prev = new Set();
|
||||||
|
|
||||||
function prepend_base(suggestion) {
|
function prepend_base(suggestion) {
|
||||||
if (base && base.description.length > 0) {
|
if (base && base.description.length > 0) {
|
||||||
@@ -592,8 +592,8 @@ function make_attacher(base) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.push = function (suggestion) {
|
self.push = function (suggestion) {
|
||||||
if (!prev[suggestion.search_string]) {
|
if (!prev.has(suggestion.search_string)) {
|
||||||
prev[suggestion.search_string] = suggestion;
|
prev.add(suggestion.search_string);
|
||||||
self.result.push(suggestion);
|
self.result.push(suggestion);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user