mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Fix leaky subscription (#45778)
This commit is contained in:
parent
60c4578587
commit
a2f6e44fed
2 changed files with 11 additions and 1 deletions
|
@ -24,6 +24,7 @@ import { initializeInput } from '../input';
|
|||
import { initializeOutput } from '../output';
|
||||
import init from '../app';
|
||||
import { getEndpointFromPosition } from '../autocomplete';
|
||||
import mappings from '../mappings';
|
||||
import { DOC_LINK_VERSION } from 'ui/documentation_links';
|
||||
|
||||
// welcome message
|
||||
|
@ -134,4 +135,8 @@ module.controller('SenseController', function SenseController($scope, $timeout,
|
|||
event.preventDefault();
|
||||
input.focus();
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', () => {
|
||||
mappings.clearSubscriptions();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -289,10 +289,14 @@ function retrieveSettings(settingsKey, settingsToRetrieve) {
|
|||
// unchanged alone (both selected and unselected).
|
||||
// 3. Poll: Use saved. Fetch selected. Ignore unselected.
|
||||
|
||||
function retrieveAutoCompleteInfo(settingsToRetrieve = settings.getAutocomplete()) {
|
||||
function clearSubscriptions() {
|
||||
if (pollTimeoutId) {
|
||||
clearTimeout(pollTimeoutId);
|
||||
}
|
||||
}
|
||||
|
||||
function retrieveAutoCompleteInfo(settingsToRetrieve = settings.getAutocomplete()) {
|
||||
clearSubscriptions();
|
||||
|
||||
const mappingPromise = retrieveSettings('fields', settingsToRetrieve);
|
||||
const aliasesPromise = retrieveSettings('indices', settingsToRetrieve);
|
||||
|
@ -346,4 +350,5 @@ export default {
|
|||
expandAliases,
|
||||
clear,
|
||||
retrieveAutoCompleteInfo,
|
||||
clearSubscriptions
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue