Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

dont re-render on scroll

Jason Kent3872cc56fced
diff --git a/web/js/components/layer/product-picker/product-picker.js b/web/js/components/layer/product-picker/product-picker.js
index eda336448..fadbd055d 100644
--- a/web/js/components/layer/product-picker/product-picker.js
+++ b/web/js/components/layer/product-picker/product-picker.js
@@ -48,7 +48,8 @@ class ProductPicker extends React.Component {
this.state = {
modalElement: null,
- listScrollRef: React.createRef()
+ listScrollRef: React.createRef(),
+ listScrollTop: props.listScrollTop || 0
};
this.runSearch = lodashDebounce(this.runSearch, 300);
}
@@ -270,6 +271,7 @@ class ProductPicker extends React.Component {
}
renderLayerList() {
+ const { listScrollRef, listScrollTop } = this.state;
const {
isMobile,
categoryConfig,
@@ -290,15 +292,14 @@ class ProductPicker extends React.Component {
category,
selectedMeasurement,
selectedLayer,
- listScrollTop,
updateScrollPosition
} = this.props;
- const { listScrollRef } = this.state;
const debouncedUpdateScroll = lodashDebounce(() => {
const { scrollTop } = listScrollRef.current.contentWrapperEl;
updateScrollPosition(scrollTop);
}, 500);
+
const isSearching = listType === 'search';
const listHeight = isMobile && isSearching
? selectedLayer
@@ -314,8 +315,6 @@ class ProductPicker extends React.Component {
? 'layer-list-container browse mobile'
: 'layer-list-container browse';
- console.log('ahhhhh rendeirng!');
-
return filteredRows.length || !isSearching ? (
<>
{ isSearching &&
@@ -549,6 +548,7 @@ ProductPicker.propTypes = {
selectedLayer: PropTypes.object,
selectedMeasurement: PropTypes.string,
selectedProjection: PropTypes.string,
+ update: PropTypes.func,
updateScrollPosition: PropTypes.func,
width: PropTypes.number
};
diff --git a/web/js/components/util/scrollbar.js b/web/js/components/util/scrollbar.js
index cd3b72b38..6a697c25c 100644
--- a/web/js/components/util/scrollbar.js
+++ b/web/js/components/util/scrollbar.js
@@ -49,7 +49,7 @@ export default function Scrollbars(props) {
return function cleanUp() {
contentWrapperEl.removeEventListener('scroll', props.onScroll);
};
- });
+ }, [props.scrollBarVerticalTop]);
return (
<SimpleBarReact
@@ -68,6 +68,7 @@ Scrollbars.propTypes = {
className: PropTypes.string,
onScroll: PropTypes.func,
scrollBarVerticalTop: PropTypes.number,
+ scrollRef: PropTypes.object,
style: PropTypes.object
};