Skip to content

Commit 35ac231

Browse files
committed
cleaned up subscription with take(1) and fixed an oops
1 parent a2fa6b3 commit 35ac231

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/plugins/embeddable/public/lib/actions/edit_panel_action.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import { i18n } from '@kbn/i18n';
2121
import { ApplicationStart } from 'kibana/public';
2222
import { Action } from 'src/plugins/ui_actions/public';
23+
import { take } from 'rxjs/operators';
2324
import { ViewMode } from '../types';
2425
import { EmbeddableFactoryNotFoundError } from '../errors';
2526
import { EmbeddableStart } from '../../plugin';
@@ -42,9 +43,9 @@ export class EditPanelAction implements Action<ActionContext> {
4243
private readonly application: ApplicationStart
4344
) {
4445
if (this.application?.currentAppId$) {
45-
this.application.currentAppId$.subscribe(
46-
(appId: string | undefined) => (this.currentAppId = appId)
47-
);
46+
this.application.currentAppId$
47+
.pipe(take(1))
48+
.subscribe((appId: string | undefined) => (this.currentAppId = appId));
4849
}
4950
}
5051

test/functional/apps/visualize/_pie_chart.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,8 @@ export default function({ getService, getPageObjects }) {
210210
});
211211

212212
it('should correctly save disabled agg', async () => {
213-
console.log('GONNA S A V E OUR BOI AND EXPECT SUCCESS AND BREADCRUMB');
214213
await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1);
215214

216-
console.log('NOW GONNA LOAD UP THAT SAVED VIS ALL NICE');
217215
await PageObjects.visualize.loadSavedVisualization(vizName1);
218216
await PageObjects.visChart.waitForRenderingCount();
219217

0 commit comments

Comments
 (0)