To make this widget ignore horizontal only extent changes (like those triggered by a sidebar opening or closing), add the following line just before if (firstLoad.current) {.
// Check the extents against the new extent. Must check corners as comparing objects will always result in false.
let extentChanged = false
if (newExtent.xmax !== node.current.value.xmax || newExtent.ymax !== node.current.value.ymax || newExtent.xmin !== node.current.value.xmin || newExtent.ymin !== node.current.value.ymin) {
//console.log('extent change')
extentChanged = true
}
// If only x values are change or there are no extent changes, do not log an extent change.
if ((newExtent.xmax !== node.current.value.xmax || newExtent.xmin !== node.current.value.xmin || !extentChanged) && newExtent.ymax === node.current.value.ymax && newExtent.ymin === node.current.value.ymin) {
//console.log('only x changed or no change')
fromButtons.current = true
}
Switch x's and y's to make it ignore a vertically opening sidebar.
GIS Developer
City of Arlington, Texas