11import React , { Component } from 'react'
22import { Link } from 'react-router-dom'
3+ import { isEqual } from 'lodash'
34import { getItemCSV , getSubsetCSV , getSubsetDetails } from '../api.js'
45import Header from '../common/Header.jsx'
5- // import LEI_COUNTS from '../constants/leiCounts.js'
66import MSAMD_COUNTS from '../constants/msamdCounts.js'
77import STATE_COUNTS from '../constants/stateCounts.js'
88import { makeSearchFromState , makeStateFromSearch } from '../query.js'
@@ -12,7 +12,6 @@ import './Geography.css'
1212import InstitutionSelect from './InstitutionSelect'
1313import ItemSelect from './ItemSelect.jsx'
1414import { fetchLeis , filterLeis } from './leiUtils'
15- import { isEqual } from 'lodash'
1615import {
1716 createItemOptions ,
1817 createVariableOptions ,
@@ -63,7 +62,7 @@ class Geography extends Component {
6362 leiDetails : {
6463 loading : true ,
6564 counts : { } ,
66- leis : [ ]
65+ leis : { }
6766 }
6867 }
6968
@@ -76,9 +75,7 @@ class Geography extends Component {
7675 componentDidMount ( ) {
7776 this . fetchLeis ( )
7877 this . filterLeis ( )
79- this . setState ( {
80- isLargeFile : this . checkIfLargeFile ( this . state . category , this . state . items )
81- } )
78+ this . setState ( { isLargeFile : this . checkIfLargeFile ( this . state . category , this . state . items ) } )
8279 }
8380
8481 componentDidUpdate ( prevProps , prevState ) {
@@ -88,9 +85,7 @@ class Geography extends Component {
8885 if ( geographyChanged ) this . fetchLeis ( )
8986 if ( geographyChanged || leisReloaded ) this . filterLeis ( )
9087 if ( leisReloaded )
91- this . setState ( {
92- isLargeFile : this . checkIfLargeFile ( this . state . category , this . state . items )
93- } )
88+ this . setState ( { isLargeFile : this . checkIfLargeFile ( this . state . category , this . state . items ) } )
9489 }
9590
9691 updateSearch ( ) {
@@ -167,8 +162,7 @@ class Geography extends Component {
167162 checkIfLargeCount ( selected , countMap ) {
168163 const MAX = 1048576
169164 if ( ! selected ) return countMap > MAX
170- const count = selected . reduce ( ( acc , curr ) => acc + countMap [ curr ] , 0 )
171- return count > MAX
165+ return selected . reduce ( ( acc , curr ) => acc + countMap [ curr ] , 0 ) > MAX
172166 }
173167
174168 onCategoryChange ( catObj ) {
@@ -268,7 +262,8 @@ class Geography extends Component {
268262 }
269263
270264 render ( ) {
271- const { category, items, leis, isLargeFile, variables, orderedVariables, details, loadingDetails, error } = this . state
265+ const { category, details, error, isLargeFile, items, leiDetails, leis,
266+ loadingDetails, orderedVariables, variables } = this . state
272267
273268 const nationwide = isNationwide ( category )
274269 const enabled = nationwide || items . length
@@ -309,10 +304,7 @@ class Geography extends Component {
309304 < InstitutionSelect
310305 items = { leis }
311306 onChange = { this . onInstitutionChange }
312- options = { this . itemOptions }
313- geoCategory = { category }
314- geoItems = { items }
315- leiDetails = { this . state . leiDetails }
307+ leiDetails = { leiDetails }
316308 />
317309 < VariableSelect
318310 options = { this . variableOptions }
0 commit comments