[dashboard] fix map center change shows unsaved change after clicking reset (#213445)

Closes https://github.com/elastic/kibana/issues/213444

The problem is setting the view with the globe view may not set the view
to the exact value. For example setting zoom to 1.74 may move the map to
zoom 1.77. PR resolves this problem by adding a margin of error for
comparing zoom differences.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2025-03-07 08:15:21 -07:00 committed by GitHub
parent da4ab47ff6
commit ea266bcd7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -219,7 +219,16 @@ export function initializeReduxSync({
(nextValue: MapCenterAndZoom) => {
store.dispatch(setGotoWithCenter(nextValue));
},
fastIsEqual,
(a, b) => {
if (!a || !b) {
return a === b;
}
if (a.lat !== b.lat) return false;
if (a.lon !== b.lon) return false;
// Map may not restore reset zoom exactly
return Math.abs(a.zoom - b.zoom) < 0.05;
},
],
openTOCDetails: [
openTOCDetails$,