From 20aa0da7462f8350358ad1c352c16f8ce67b9981 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 15 Jul 2019 14:31:51 +0200 Subject: [PATCH] fix(geo): check for undefined in isEqual (#2643) issue introduced in #2467 IFW-851 --- packages/react-instantsearch-dom-maps/src/Connector.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/react-instantsearch-dom-maps/src/Connector.js b/packages/react-instantsearch-dom-maps/src/Connector.js index ea16288488..e6ee37777e 100644 --- a/packages/react-instantsearch-dom-maps/src/Connector.js +++ b/packages/react-instantsearch-dom-maps/src/Connector.js @@ -7,6 +7,10 @@ function isEqualPosition(a, b) { if (a === b) { return true; } + if (a === undefined || b === undefined) { + return false; + } + return a.lat === b.lat && a.lng === b.lng; } @@ -14,6 +18,11 @@ function isEqualCurrentRefinement(a, b) { if (a === b) { return true; } + + if (a === undefined || b === undefined) { + return false; + } + return ( isEqualPosition(a.northEast, b.northEast) && isEqualPosition(a.southWest, b.southWest)