Skip to content

Commit

Permalink
[Maps] fix 'New Map' from getting added to recently accessed (#72125)
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese authored Jul 16, 2020
1 parent 4278e56 commit d510263
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React from 'react';
import { MapsAppView } from '.';
import { getMapsSavedObjectLoader } from '../../bootstrap/services/gis_map_saved_object_loader';
import { getToasts } from '../../../kibana_services';
import { getCoreChrome, getToasts } from '../../../kibana_services';
import { i18n } from '@kbn/i18n';
import { Redirect } from 'react-router-dom';

Expand All @@ -30,6 +30,10 @@ export const LoadMapAndRender = class extends React.Component {
try {
const savedMap = await getMapsSavedObjectLoader().get(this.props.savedMapId);
if (this._isMounted) {
getCoreChrome().docTitle.change(savedMap.title);
if (this.props.savedMapId) {
getCoreChrome().recentlyAccessed.add(savedMap.getFullPath(), savedMap.title, savedMap.id);
}
this.setState({ savedMap });
}
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ export class MapsAppView extends React.Component {
}

componentDidMount() {
const { savedMap } = this.props;

getCoreChrome().docTitle.change(savedMap.title);
getCoreChrome().recentlyAccessed.add(savedMap.getFullPath(), savedMap.title, savedMap.id);

// Init sync utils
// eslint-disable-next-line react-hooks/rules-of-hooks
this._globalSyncUnsubscribe = useGlobalStateSyncing();
Expand Down

0 comments on commit d510263

Please sign in to comment.