mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Fix navigateToApp behavior when openInNewTab is true (#110712)
This commit is contained in:
parent
467e5851a3
commit
854e0d4d85
2 changed files with 19 additions and 5 deletions
|
@ -804,6 +804,21 @@ describe('#start()', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
it("when openInNewTab is true it doesn't update currentApp$ after mounting", async () => {
|
||||
service.setup(setupDeps);
|
||||
|
||||
const { currentAppId$, navigateToApp } = await service.start(startDeps);
|
||||
const stop$ = new Subject();
|
||||
const promise = currentAppId$.pipe(bufferCount(4), takeUntil(stop$)).toPromise();
|
||||
|
||||
await navigateToApp('delta', { openInNewTab: true });
|
||||
stop$.next();
|
||||
|
||||
const appIds = await promise;
|
||||
|
||||
expect(appIds).toBeUndefined();
|
||||
});
|
||||
|
||||
it('updates httpLoadingCount$ while mounting', async () => {
|
||||
// Use a memory history so that mounting the component will work
|
||||
const { createMemoryHistory } = jest.requireActual('history');
|
||||
|
|
|
@ -250,16 +250,15 @@ export class ApplicationService {
|
|||
if (path === undefined) {
|
||||
path = applications$.value.get(appId)?.defaultPath;
|
||||
}
|
||||
if (!navigatingToSameApp) {
|
||||
this.appInternalStates.delete(this.currentAppId$.value!);
|
||||
}
|
||||
if (openInNewTab) {
|
||||
this.openInNewTab!(getAppUrl(availableMounters, appId, path));
|
||||
} else {
|
||||
if (!navigatingToSameApp) {
|
||||
this.appInternalStates.delete(this.currentAppId$.value!);
|
||||
}
|
||||
this.navigate!(getAppUrl(availableMounters, appId, path), state, replace);
|
||||
this.currentAppId$.next(appId);
|
||||
}
|
||||
|
||||
this.currentAppId$.next(appId);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue