mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Don't throw an error is panel is added, then removed, before embeddable finishes loading (#46788) (#47818)
* Remove this error being thrown as it can be expected in certain situations * change test after change in logic
This commit is contained in:
parent
0419844ee3
commit
8ed19f2c42
2 changed files with 5 additions and 7 deletions
|
@ -181,11 +181,10 @@ export abstract class Container<
|
|||
resolve(this.children[id] as TEmbeddable);
|
||||
}
|
||||
|
||||
// If a panel is removed before the embeddable was loaded there is a chance this will
|
||||
// never resolve.
|
||||
// If we hit this, the panel was removed before the embeddable finished loading.
|
||||
if (this.input.panels[id] === undefined) {
|
||||
subscription.unsubscribe();
|
||||
reject(new PanelNotFoundError());
|
||||
resolve(undefined);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -27,7 +27,6 @@ import {
|
|||
} from '../lib/test_samples/embeddables/filterable_embeddable';
|
||||
import { ERROR_EMBEDDABLE_TYPE } from '../lib/embeddables/error_embeddable';
|
||||
import { Filter, FilterStateStore } from '@kbn/es-query';
|
||||
import { PanelNotFoundError } from '../lib/errors';
|
||||
import { FilterableEmbeddableFactory } from '../lib/test_samples/embeddables/filterable_embeddable_factory';
|
||||
import { CONTACT_CARD_EMBEDDABLE } from '../lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory';
|
||||
import { SlowContactCardEmbeddableFactory } from '../lib/test_samples/embeddables/contact_card/slow_contact_card_embeddable_factory';
|
||||
|
@ -753,7 +752,7 @@ test('untilEmbeddableLoaded() resolves if child is loaded in the container', asy
|
|||
done();
|
||||
});
|
||||
|
||||
test('untilEmbeddableLoaded rejects with an error if child is subsequently removed', async done => {
|
||||
test('untilEmbeddableLoaded resolves with undefined if child is subsequently removed', async done => {
|
||||
const { doStart, coreStart, uiActions } = testPlugin(
|
||||
coreMock.createSetup(),
|
||||
coreMock.createStart()
|
||||
|
@ -785,8 +784,8 @@ test('untilEmbeddableLoaded rejects with an error if child is subsequently remov
|
|||
}
|
||||
);
|
||||
|
||||
container.untilEmbeddableLoaded('123').catch(error => {
|
||||
expect(error).toBeInstanceOf(PanelNotFoundError);
|
||||
container.untilEmbeddableLoaded('123').then(embed => {
|
||||
expect(embed).toBeUndefined();
|
||||
done();
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue