[Notebook] new notebook entry causes console error #3440 (#3443)

* [Notebook] new notebook entry causes console error #3440

* using 'makeKeyString' to compare notebook identifiers

Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
This commit is contained in:
Nikhil 2020-10-19 17:57:57 -07:00 committed by GitHub
parent 184b716b53
commit 142b767470
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,6 +112,8 @@ import SearchResults from './SearchResults.vue';
import Sidebar from './Sidebar.vue';
import { clearDefaultNotebook, getDefaultNotebook, setDefaultNotebook, setDefaultNotebookSection, setDefaultNotebookPage } from '../utils/notebook-storage';
import { DEFAULT_CLASS, addNotebookEntry, createNewEmbed, getNotebookEntries } from '../utils/notebook-entries';
import objectUtils from 'objectUtils';
import { throttle } from 'lodash';
export default {
@ -431,7 +433,9 @@ export default {
},
async updateDefaultNotebook(notebookStorage) {
const defaultNotebookObject = await this.getDefaultNotebookObject();
if (defaultNotebookObject.identifier.key !== notebookStorage.notebookMeta.identifier.key) {
if (!defaultNotebookObject) {
setDefaultNotebook(this.openmct, notebookStorage);
} else if (objectUtils.makeKeyString(defaultNotebookObject.identifier) !== objectUtils.makeKeyString(notebookStorage.notebookMeta.identifier)) {
this.removeDefaultClass(defaultNotebookObject);
setDefaultNotebook(this.openmct, notebookStorage);
}