Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

make dialogs update when clicking while open #2420

Benjamin King5f75eaa91f4d
diff --git a/web/js/components/vector-metadata/table.js b/web/js/components/vector-metadata/table.js
index ef0a198c1..9de3deb4c 100644
--- a/web/js/components/vector-metadata/table.js
+++ b/web/js/components/vector-metadata/table.js
@@ -13,7 +13,7 @@ export default class VectorMetaTable extends React.Component {
}
shouldComponentUpdate(nextProps) {
- if (this.props.title && nextProps.title && this.props.title === nextProps.title) {
+ if (this.props.id && nextProps.id && this.props.id === nextProps.id) {
return false;
} else {
return true;
diff --git a/web/js/containers/map-interactions.js b/web/js/containers/map-interactions.js
index 7166b7540..9b840d1d4 100644
--- a/web/js/containers/map-interactions.js
+++ b/web/js/containers/map-interactions.js
@@ -94,6 +94,7 @@ const mapDispatchToProps = dispatch => ({
modalClassName: 'vector-modal light',
CompletelyCustomModal: vectorDialog,
isResizable: true,
+ dialogKey: new Date().getUTCMilliseconds(),
vectorMetaObject: lodashGroupBy(metaArray, 'id'),
width: 445,
height: 300,
diff --git a/web/js/containers/vector-dialog.js b/web/js/containers/vector-dialog.js
index 1c1a273fb..444ebe741 100644
--- a/web/js/containers/vector-dialog.js
+++ b/web/js/containers/vector-dialog.js
@@ -18,7 +18,7 @@ class VectorDialog extends React.Component {
}
render() {
- const { toggleWithClose, vectorMetaObject, modalHeight } = this.props;
+ const { toggleWithClose, vectorMetaObject, modalHeight, dialogKey } = this.props;
const { activeIndex } = this.state;
const navArray = [];
const keyArray = [];
@@ -54,7 +54,7 @@ class VectorDialog extends React.Component {
<ModalBody>
<Scrollbars style={{ maxHeight: modalHeight - 70 + 'px' }} >
- <VectorMetaTable metaArray={activeMetaArray} title={keyArray[activeIndex]} />
+ <VectorMetaTable id={dialogKey} metaArray={activeMetaArray} title={keyArray[activeIndex]} />
</ Scrollbars>
</ModalBody>
</div>
diff --git a/web/js/modules/vector-styles/util.js b/web/js/modules/vector-styles/util.js
index 13d8ec47e..961a0e899 100644
--- a/web/js/modules/vector-styles/util.js
+++ b/web/js/modules/vector-styles/util.js
@@ -162,7 +162,7 @@ export function onMapClickGetVectorFeatures(pixels, map, state) {
offsetTop = y - modalHeight;
}
- map.forEachFeatureAtPixel(pixels, function(feature, layer) {
+ map.forEachFeatureAtPixel(pixels, function (feature, layer) {
const def = lodashGet(layer, 'wv.def');
if (!def) return;
if (def.vectorData && def.vectorData.id && def.title) {
@@ -185,6 +185,7 @@ export function onMapClickGetVectorFeatures(pixels, map, state) {
id: vectorDataId,
title: def.title || def.id,
featureTitle: title
+
};
metaArray.push(obj);
selected[layerId].push(uniqueIdentifier);