Additional code has been added to investigate exception: 'Cannot read property label of undefined' (#2220)

main
Boris Sekachev 5 years ago committed by GitHub
parent d4b0e11cab
commit 6370f980eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -100,29 +100,41 @@ function mapStateToProps(state: CombinedState, own: OwnProps): StateToProps {
}, },
} = state; } = state;
const index = states const stateIDs = states.map((_state: any): number => _state.clientID);
.map((_state: any): number => _state.clientID) const index = stateIDs.indexOf(own.clientID);
.indexOf(own.clientID);
const collapsedState = typeof (statesCollapsed[own.clientID]) === 'undefined' try {
? own.initialCollapsed : statesCollapsed[own.clientID]; const collapsedState = typeof (statesCollapsed[own.clientID]) === 'undefined'
? own.initialCollapsed : statesCollapsed[own.clientID];
return { return {
objectState: states[index], objectState: states[index],
collapsed: collapsedState, collapsed: collapsedState,
attributes: jobAttributes[states[index].label.id], attributes: jobAttributes[states[index].label.id],
labels, labels,
ready, ready,
activeControl, activeControl,
colorBy, colorBy,
jobInstance, jobInstance,
frameNumber, frameNumber,
activated: activatedStateID === own.clientID, activated: activatedStateID === own.clientID,
minZLayer, minZLayer,
maxZLayer, maxZLayer,
normalizedKeyMap, normalizedKeyMap,
aiToolsRef, aiToolsRef,
}; };
} catch (exception) {
// we have an exception here sometimes
// but I cannot understand when it happens and what is the root reason
// maybe this temporary hack helps us
const dataObject = {
index,
frameNumber,
clientID: own.clientID,
stateIDs,
};
throw new Error(`${exception.toString()} in mapStateToProps of ObjectItemContainer. Data are ${JSON.stringify(dataObject)}`);
}
} }
function mapDispatchToProps(dispatch: any): DispatchToProps { function mapDispatchToProps(dispatch: any): DispatchToProps {

Loading…
Cancel
Save