Skip to content

Commit 16d94d3

Browse files
committed
Add checks for location and facetState props when checking for url parameter constraints
1 parent ca8cde5 commit 16d94d3

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/client/components/facet_results/ApexCharts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ApexChart extends React.Component {
4545
let constraints = []
4646

4747
// first check if page or constraints were given as url parameter
48-
if (this.props.location.search !== '') {
48+
if (this.props.location && this.props.location.search !== '') {
4949
const qs = this.props.location.search.replace('?', '')
5050
const parsedConstraints = querystring.parse(qs).constraints
5151
// do not try to import constraints twice for ApexChartsDouble components
@@ -108,7 +108,7 @@ class ApexChart extends React.Component {
108108

109109
// check if facets are still fetching
110110
let someFacetIsFetching = false
111-
if (pageType === 'facetResults') Object.values(this.props.facetState.facets).forEach(facet => { if (facet.isFetching) { someFacetIsFetching = true } })
111+
if (pageType === 'facetResults' && this.props.facetState) Object.values(this.props.facetState.facets).forEach(facet => { if (facet.isFetching) { someFacetIsFetching = true } })
112112

113113
// refetch default facets (excl. text facets) when facets have been updated
114114
if (this.state.defaultFacetFetchingRequired && this.props.facetUpdateID > 0 && !someFacetIsFetching) {

src/client/components/facet_results/Deck.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Deck extends React.Component {
7676
let constraints = []
7777

7878
// first check if page or constraints were given as url parameter
79-
if (this.props.location.search !== '') {
79+
if (this.props.location && this.props.location.search !== '') {
8080
const qs = this.props.location.search.replace('?', '')
8181
const parsedConstraints = querystring.parse(qs).constraints
8282
constraints = parsedConstraints ? JSON.parse(decodeURIComponent(parsedConstraints)) : []

src/client/components/facet_results/LeafletMap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class LeafletMap extends React.Component {
7878
let constraints = []
7979

8080
// first check if page or constraints were given as url parameter
81-
if (this.props.location.search !== '') {
81+
if (this.props.location && this.props.location.search !== '') {
8282
const qs = this.props.location.search.replace('?', '')
8383
const parsedConstraints = querystring.parse(qs).constraints
8484
constraints = parsedConstraints ? JSON.parse(decodeURIComponent(parsedConstraints)) : []

src/client/components/facet_results/ResultTable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class ResultTable extends React.Component {
8787
let constraints = []
8888

8989
// first check if page or constraints were given as url parameter
90-
if (this.props.location.search === '') {
90+
if (this.props.location && this.props.location.search === '') {
9191
page = this.props.data.page === -1 ? 0 : this.props.data.page
9292
} else {
9393
const qs = this.props.location.search.replace('?', '')
@@ -136,7 +136,7 @@ class ResultTable extends React.Component {
136136

137137
// check if facets are still fetching
138138
let someFacetIsFetching = false
139-
Object.values(this.props.facetState.facets).forEach(facet => { if (facet.isFetching) { someFacetIsFetching = true } })
139+
if (this.props.facetState) Object.values(this.props.facetState.facets).forEach(facet => { if (facet.isFetching) { someFacetIsFetching = true } })
140140
// refetch default facets (excl. text facets) when facets have been updated
141141
if (this.state.defaultFacetFetchingRequired && this.props.facetUpdateID > 0 && !someFacetIsFetching) {
142142
const defaultFacets = this.props.perspectiveConfig.defaultActiveFacets

0 commit comments

Comments
 (0)