Skip to content

Commit d510263

Browse files
authored
[Maps] fix 'New Map' from getting added to recently accessed (#72125)
1 parent 4278e56 commit d510263

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

x-pack/plugins/maps/public/routing/routes/maps_app/load_map_and_render.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import React from 'react';
88
import { MapsAppView } from '.';
99
import { getMapsSavedObjectLoader } from '../../bootstrap/services/gis_map_saved_object_loader';
10-
import { getToasts } from '../../../kibana_services';
10+
import { getCoreChrome, getToasts } from '../../../kibana_services';
1111
import { i18n } from '@kbn/i18n';
1212
import { Redirect } from 'react-router-dom';
1313

@@ -30,6 +30,10 @@ export const LoadMapAndRender = class extends React.Component {
3030
try {
3131
const savedMap = await getMapsSavedObjectLoader().get(this.props.savedMapId);
3232
if (this._isMounted) {
33+
getCoreChrome().docTitle.change(savedMap.title);
34+
if (this.props.savedMapId) {
35+
getCoreChrome().recentlyAccessed.add(savedMap.getFullPath(), savedMap.title, savedMap.id);
36+
}
3337
this.setState({ savedMap });
3438
}
3539
} catch (err) {

x-pack/plugins/maps/public/routing/routes/maps_app/maps_app_view.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ export class MapsAppView extends React.Component {
5656
}
5757

5858
componentDidMount() {
59-
const { savedMap } = this.props;
60-
61-
getCoreChrome().docTitle.change(savedMap.title);
62-
getCoreChrome().recentlyAccessed.add(savedMap.getFullPath(), savedMap.title, savedMap.id);
63-
6459
// Init sync utils
6560
// eslint-disable-next-line react-hooks/rules-of-hooks
6661
this._globalSyncUnsubscribe = useGlobalStateSyncing();

0 commit comments

Comments
 (0)