Skip to content

Commit 6e048da

Browse files
authored
bug/minor: prevent UI crash with long similar text (#988)
1 parent 6bd5229 commit 6e048da

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/tom-select.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,12 @@ export default class TomSelect extends MicroPlugin(MicroEvent){
13621362
// perform search
13631363
if (query !== self.lastQuery) {
13641364
self.lastQuery = query;
1365-
result = self.sifter.search(query, Object.assign(options, {score: calculateScore}));
1365+
// temp fix for https://github.com/orchidjs/tom-select/issues/987
1366+
// UI crashed when more than 30 same chars in a row, prevent search and return empt result
1367+
if (/(.)\1{15,}/.test(query)) {
1368+
query = '';
1369+
}
1370+
result = self.sifter.search(query, Object.assign(options, { score: calculateScore }));
13661371
self.currentResults = result;
13671372
} else {
13681373
result = Object.assign( {}, self.currentResults);

0 commit comments

Comments
 (0)