Skip to content
Snippets Groups Projects
Commit 704322d6 authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Prevent duplicate search queries

parent 2282c924
No related branches found
No related tags found
1 merge request!1081Prevent duplicate search queries
......@@ -4,7 +4,7 @@
<span class="select is-fullwidth mb-4">
<select v-model="corpusId" :disabled="loading" v-on:change="reset">
<option value="" selected disabled>Choose a project</option>
<option v-for="corpus in indexableCorpus" :key="corpus.id" :value="corpus.id">{{ corpus.name }}</option>
<option v-for="corpus in indexableCorpora" :key="corpus.id" :value="corpus.id">{{ corpus.name }}</option>
</select>
</span>
<template v-if="corpusId">
......@@ -162,8 +162,7 @@ export default {
// Ignore the corpus query param if it is not a known corpus ID
if (!this.params.corpus || (
this.indexableCorpus &&
!this.indexableCorpus.filter(c => c.id === this.params.corpus)
!this.indexableCorpora?.find(c => c.id === this.params.corpus)
)) {
this.corpusId = ''
} else {
......@@ -191,7 +190,7 @@ export default {
},
async search () {
// Run the actual search
if (!this.isValid()) return
if (!this.isValid() || this.loading) return
this.loading = true
try {
const payload = this.parsedQuery
......@@ -206,7 +205,7 @@ export default {
}
},
computed: {
indexableCorpus () {
indexableCorpora () {
if (!this.corpora) return []
return Object.values(this.corpora).filter(c => c.indexable)
},
......@@ -236,7 +235,7 @@ export default {
},
watch: {
allFacets: 'updateFacets',
indexableCorpus: 'parseParams',
indexableCorpora: 'parseParams',
/*
* Start a search immediately once a project is picked as this can cause confusion,
* or search again if we switch to another project
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment