mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
render only once (#90601)
This commit is contained in:
parent
9da625b31d
commit
40570a633f
2 changed files with 10 additions and 6 deletions
|
@ -104,7 +104,7 @@ describe('embeddable', () => {
|
|||
mountpoint.remove();
|
||||
});
|
||||
|
||||
it('should render expression with expression renderer', async () => {
|
||||
it('should render expression once with expression renderer', async () => {
|
||||
const embeddable = new Embeddable(
|
||||
{
|
||||
timefilter: dataPluginMock.createSetupContract().query.timefilter.timefilter,
|
||||
|
@ -123,11 +123,18 @@ describe('embeddable', () => {
|
|||
],
|
||||
}),
|
||||
},
|
||||
{} as LensEmbeddableInput
|
||||
{
|
||||
timeRange: {
|
||||
from: 'now-15m',
|
||||
to: 'now',
|
||||
},
|
||||
} as LensEmbeddableInput
|
||||
);
|
||||
await embeddable.initializeSavedVis({} as LensEmbeddableInput);
|
||||
embeddable.render(mountpoint);
|
||||
|
||||
// wait one tick to give embeddable time to initialize
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
|
||||
expect(expressionRenderer).toHaveBeenCalledTimes(1);
|
||||
expect(expressionRenderer.mock.calls[0][0]!.expression).toEqual(`my
|
||||
| expression`);
|
||||
|
|
|
@ -229,9 +229,6 @@ export class Embeddable
|
|||
this.expression = expression ? toExpression(expression) : null;
|
||||
await this.initializeOutput();
|
||||
this.isInitialized = true;
|
||||
if (this.domNode) {
|
||||
this.render(this.domNode);
|
||||
}
|
||||
}
|
||||
|
||||
onContainerStateChanged(containerState: LensEmbeddableInput) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue