Skip to content

Commit

Permalink
fix(find): watch processedTasks to re-initialise results
Browse files Browse the repository at this point in the history
This fix makes sure that default results entries are created whenever the component receives and
processes new tasks, avoiding a type error on appendColorAndLabel on continue mapping.
  • Loading branch information
ofr1tz committed May 26, 2024
1 parent d41f6f4 commit 11e399e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/FindProject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ export default defineComponent({
saveResults: 'saveResults',
showSnackbar: 'showSnackbar',
},
watch: {
processedTasks: {
handler(newTasks) {
newTasks.forEach((task) => (this.results[task.taskId] = this.options[0].value))
this.startTime = new Date().toISOString()
},
immediate: true,
},
},
computed: {
allTilesSelected() {
return this.selectedTaskIds.length === this.page.flat().length
Expand Down Expand Up @@ -147,7 +156,7 @@ export default defineComponent({
appendColorAndLabel(task) {
const value = this.results[task.taskId]
const index = this.options.findIndex((option) => option.value == value)
task.index = index
task.index = index || 0
task.value = this.options[index].value
task.color = this.options[index].color
task.label = this.options[index].label
Expand Down Expand Up @@ -248,8 +257,6 @@ export default defineComponent({
this.onResize()
},
created() {
this.startTime = new Date().toISOString()
this.processedTasks.forEach((task) => (this.results[task.taskId] = this.options[0].value))
this.logMappingStarted(this.project.projectType)
},
})
Expand Down

0 comments on commit 11e399e

Please sign in to comment.