perf: @结果相同时避免刷新

This commit is contained in:
kuaifan 2022-11-21 14:21:52 +08:00
parent 4d5c5b052d
commit a63b867a5a

View File

@ -576,6 +576,7 @@ export default {
containers[i].classList.add(mentionName);
$A.scrollPreventThrough(containers[i]);
}
let mentionSourceCache = null;
this.getMentionSource(mentionChar, searchTerm, array => {
const values = [];
array.some(item => {
@ -588,7 +589,10 @@ export default {
values.push(...list)
}
})
renderList(values, searchTerm);
if ($A.jsonStringify(values.map(({id}) => id)) !== mentionSourceCache) {
mentionSourceCache = $A.jsonStringify(values.map(({id}) => id))
renderList(values, searchTerm);
}
})
}
}