diff --git a/js/components/nglView/renderingObjects.js b/js/components/nglView/renderingObjects.js index 54139deb4..10e58334a 100644 --- a/js/components/nglView/renderingObjects.js +++ b/js/components/nglView/renderingObjects.js @@ -398,6 +398,7 @@ const showDensity = ({ stage, input_dict, object_name, representations, dispatch opacity: input_dict.opacity || 1, opaqueBack: false }; + return Promise.all([ input_dict.sigmaa_url && stage.loadFile(input_dict.sigmaa_url, { ext: 'map' }).then(comp => { @@ -419,7 +420,8 @@ const showDensity = ({ stage, input_dict, object_name, representations, dispatch return assignRepresentationArrayToComp(reprArray, comp); }) ]).then(values => { - let val = [...values]; + let val = [...values].filter(v => v !== undefined); + return val; }); }; diff --git a/js/components/preview/molecule/redux/actions.js b/js/components/preview/molecule/redux/actions.js index 912c0598f..f8fe11c4a 100644 --- a/js/components/preview/molecule/redux/actions.js +++ b/js/components/preview/molecule/redux/actions.js @@ -17,5 +17,5 @@ export const addImageToCache = (molId, image) => ({ export const addProteindDataToCache = (molId, proteinData) => ({ type: constants.ADD_PROTEIN_DATA_TO_CACHE, - payload: { molId: molId, image: proteinData } + payload: { molId: molId, proteinData: proteinData } }); diff --git a/js/components/preview/molecule/redux/dispatchActions.js b/js/components/preview/molecule/redux/dispatchActions.js index e41118899..babc61f60 100644 --- a/js/components/preview/molecule/redux/dispatchActions.js +++ b/js/components/preview/molecule/redux/dispatchActions.js @@ -52,7 +52,7 @@ import { resetCurrentCompoundSettingsWithoutSelection } from '../../compounds/re import { selectMoleculeGroup } from '../../moleculeGroups/redux/dispatchActions'; import { setDirectAccessProcessed } from '../../../../reducers/api/actions'; import { MOL_TYPE } from './constants'; -import { addImageToCache } from './actions'; +import { addImageToCache, addProteindDataToCache } from './actions'; import { OBJECT_TYPE } from '../../../nglView/constants'; import { getRepresentationsByType } from '../../../nglView/generatingObjects'; import { readQualityInformation } from '../../../nglView/renderingHelpers'; @@ -294,7 +294,7 @@ export const addDensity = ( ) => dispatch => { dispatch(getProteinData(data)).then(i => { if (i && i.length > 0) { - data.protein_data = i[0]; + data.proteinData = i[0]; dispatch( loadObject({ @@ -795,7 +795,7 @@ export const getProteinData = molecule => (dispatch, getState) => { } else { return loadProteinData(code).then(i => { if (!proteindDataCache.hasOwnProperty(molIdStr)) { - dispatch(addImageToCache(molId.toString(), i)); + dispatch(addProteindDataToCache(molId.toString(), i)); } return i; }); diff --git a/js/reducers/ngl/dispatchActions.js b/js/reducers/ngl/dispatchActions.js index bdd987c97..ff56d66d5 100644 --- a/js/reducers/ngl/dispatchActions.js +++ b/js/reducers/ngl/dispatchActions.js @@ -65,7 +65,9 @@ export const loadObject = ({ dispatch }) .then(representations => { - dispatch(loadNglObject(versionFixedTarget, representations)); + if (representations && representations.length > 0) { + dispatch(loadNglObject(versionFixedTarget, representations)); + } }) .catch(error => { console.error(error);