summaryrefslogtreecommitdiff
path: root/scraper/client/common/autocomplete.component.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-03-28 15:27:56 +0100
committerJules Laplace <julescarbon@gmail.com>2019-03-28 15:27:56 +0100
commit3bad596c05c8305d327955225d3d10aacce78da1 (patch)
treebfc7788a60d13fbcdcea71313aeebdc6ea69a05f /scraper/client/common/autocomplete.component.js
parentad6284a2040837e7373b4d89644a01306f181dd5 (diff)
add paper addresses to unverified papers
Diffstat (limited to 'scraper/client/common/autocomplete.component.js')
-rw-r--r--scraper/client/common/autocomplete.component.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/scraper/client/common/autocomplete.component.js b/scraper/client/common/autocomplete.component.js
index e2908cd1..a619e2c8 100644
--- a/scraper/client/common/autocomplete.component.js
+++ b/scraper/client/common/autocomplete.component.js
@@ -49,6 +49,10 @@ class Autocomplete extends Component {
componentDidMount() {
// build index based on what's in the hierarchy
+ if (!this.props.institutions.loading) this.buildIndex()
+ }
+
+ buildIndex() {
const { entities, lookup } = this.props.institutions
let index = []
this.index = index
@@ -69,6 +73,9 @@ class Autocomplete extends Component {
}
componentDidUpdate(oldProps) {
+ if (oldProps.institutions.loading && !this.props.institutions.loading) {
+ this.buildIndex()
+ }
if (this.props.vetting !== oldProps.vetting) {
this.handleChange({ target: { value: this.props.vetting } })
} else if (this.props.value !== oldProps.value) {