From 78ac0f59e49f064dba74803a398839fcb177df52 Mon Sep 17 00:00:00 2001 From: KhadijaMahanga Date: Wed, 15 Jan 2020 10:48:28 +0300 Subject: [PATCH 1/2] add condition --- wp-content/plugins/hurumap/src/HURUmapBlock/Chart.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-content/plugins/hurumap/src/HURUmapBlock/Chart.js b/wp-content/plugins/hurumap/src/HURUmapBlock/Chart.js index f5b0269f..e14ff225 100644 --- a/wp-content/plugins/hurumap/src/HURUmapBlock/Chart.js +++ b/wp-content/plugins/hurumap/src/HURUmapBlock/Chart.js @@ -45,9 +45,10 @@ function Chart({ const { loading: sourceLoading, data: sourceData } = useQuery( GET_CHART_SOURCE, { + skip: Boolean(geoId), variables: { - geoLevel: geoId.split('-')[0], - countryCode: geoId.split('-')[1].slice(0, 2), + geoLevel: geoId ? geoId.split('-')[0] : '', + countryCode: geoId ? geoId.split('-')[1].slice(0, 2) : '', tableName: chart.visual.table } } From 1a5d501fdb8e94168a45465f6d94c9c96b2a134a Mon Sep 17 00:00:00 2001 From: KhadijaMahanga Date: Wed, 15 Jan 2020 10:56:55 +0300 Subject: [PATCH 2/2] check visual --- wp-content/plugins/hurumap/src/HURUmapBlock/Chart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-content/plugins/hurumap/src/HURUmapBlock/Chart.js b/wp-content/plugins/hurumap/src/HURUmapBlock/Chart.js index e14ff225..ec303185 100644 --- a/wp-content/plugins/hurumap/src/HURUmapBlock/Chart.js +++ b/wp-content/plugins/hurumap/src/HURUmapBlock/Chart.js @@ -49,7 +49,7 @@ function Chart({ variables: { geoLevel: geoId ? geoId.split('-')[0] : '', countryCode: geoId ? geoId.split('-')[1].slice(0, 2) : '', - tableName: chart.visual.table + tableName: chart && chart.visual ? chart.visual.table : '' } } );