Skip to content

Commit 1a0cb3b

Browse files
committed
View3D: handle null map3dComponentRef when disabling 3D view
1 parent 0133210 commit 1a0cb3b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

plugins/View3D.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,16 @@ class View3D extends React.Component {
257257
this.setState({componentLoaded: true});
258258
});
259259
} else if (this.props.view3dMode === View3DMode.DISABLING && prevProps.view3dMode !== View3DMode.DISABLING) {
260-
this.map3dComponentRef.store3dState().then(storedState => {
261-
this.setState({storedState});
260+
if (this.map3dComponentRef) {
261+
this.map3dComponentRef.store3dState().then(storedState => {
262+
this.setState({storedState});
263+
UrlParams.updateParams({v3d: undefined, bl3d: undefined});
264+
this.props.setView3dMode(View3DMode.DISABLED);
265+
});
266+
} else {
262267
UrlParams.updateParams({v3d: undefined, bl3d: undefined});
263268
this.props.setView3dMode(View3DMode.DISABLED);
264-
});
269+
}
265270
} else if (this.props.view3dMode === View3DMode.DISABLED && prevProps.view3dMode !== View3DMode.DISABLED) {
266271
this.map3dComponent = null;
267272
this.map3dComponentRef = null;

0 commit comments

Comments
 (0)