Skip to content

Commit

Permalink
fix without a ref
Browse files Browse the repository at this point in the history
  • Loading branch information
oganm committed May 17, 2024
1 parent a4c757f commit 651e5a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/components/SearchSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
class="mb-1"/>
<TechnologyTypeSelector
v-if="searchSettings.resultTypes.indexOf(platformResultType) === -1"
v-model="searchSettings.platforms"
ref="technologyTypeSelector"
v-model="selectedTech"
:platforms="platforms"
:selectedPlatforms.sync="searchSettings.platforms"
:selectedTechnologyTypes.sync="searchSettings.technologyTypes"
:disabled="platformDisabled"
:loading="platformLoading"
Expand Down Expand Up @@ -109,6 +109,7 @@ export default {
emits: ["input"],
data() {
return {
selectedTech: [],
searchSettings: this.value,
platformResultType: ArrayDesignType,
selectedTaxa: this.value ? [this.value] : []
Expand All @@ -135,7 +136,7 @@ export default {
},
methods: {
clearAllSelections() {
this.$refs.technologyTypeSelector.clear()
this.selectedTech = []
this.searchSettings.annotations = [];
this.searchSettings.taxon = [];
this.searchSettings.query = undefined;
Expand All @@ -144,6 +145,7 @@ export default {
watch: {
searchSettings: {
handler: function(newValue) {
console.log(newValue)
this.$emit("input", newValue);
},
deep: true
Expand Down
15 changes: 10 additions & 5 deletions src/components/TechnologyTypeSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ export default {
events: ["input"],
data() {
return {
selectedValues: this.value.map(t => t.id)
};
},
computed: {
selectedValues:
{
get(){
return this.value
},
set(val){
this.$emit('input',val)
}
},
technologyTypes() {
return TOP_TECHNOLOGY_TYPES
.filter(([id]) => id !== "OTHER" || this.debug)
Expand Down Expand Up @@ -101,9 +109,6 @@ export default {
}
return [v.id];
});
},
clear() {
this.selectedValues = []
}
},
watch: {
Expand All @@ -115,7 +120,7 @@ export default {
let oldSelectedTechnologyTypes = this.computeSelectedTechnologyTypes(oldIds);
let oldSelectedPlatforms = this.computeSelectedPlatforms(oldIds, oldSelectedTechnologyTypes);
if (!isEqual(selectedPlatforms.map(p => p.id), oldSelectedPlatforms.map(p => p.id))) {
this.$emit("input", selectedPlatforms);
this.$emit("update:selectedPlatforms", selectedPlatforms);
}
if (!isEqual(selectedTechnologyTypes, oldSelectedTechnologyTypes)) {
this.$emit("update:selectedTechnologyTypes", selectedTechnologyTypes);
Expand Down

0 comments on commit 651e5a0

Please sign in to comment.