mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Fix Console bug caused by rapidly opening and closing the History tab. (#38950)
This commit is contained in:
parent
b09e3a622f
commit
b7d94b8b4c
1 changed files with 10 additions and 6 deletions
|
@ -81,7 +81,7 @@ export default function SenseEditor($el) {
|
|||
|
||||
// dirty check for tokenizer state, uses a lot less cycles
|
||||
// than listening for tokenizerUpdate
|
||||
const onceDoneTokenizing = function (func, cancelAlreadyScheduledCalls) {
|
||||
const onceDoneTokenizing = function (callback, cancelAlreadyScheduledCalls) {
|
||||
const session = editor.getSession();
|
||||
let timer = false;
|
||||
const checkInterval = 25;
|
||||
|
@ -95,11 +95,15 @@ export default function SenseEditor($el) {
|
|||
}
|
||||
|
||||
setTimeout(function check() {
|
||||
if (session.bgTokenizer.running) {
|
||||
timer = setTimeout(check, checkInterval);
|
||||
}
|
||||
else {
|
||||
func.apply(self, args);
|
||||
// If the bgTokenizer doesn't exist, we can assume that the underlying editor has been
|
||||
// torn down, e.g. by closing the History tab, and we don't need to do anything further.
|
||||
if (session.bgTokenizer) {
|
||||
// Wait until the bgTokenizer is done running before executing the callback.
|
||||
if (session.bgTokenizer.running) {
|
||||
timer = setTimeout(check, checkInterval);
|
||||
} else {
|
||||
callback.apply(self, args);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue