Skip to content

Commit

Permalink
plotter: Fix changing listened variable
Browse files Browse the repository at this point in the history
Old variable was not being unlistened and history was not being reset.
  • Loading branch information
rafaellehmkuhl committed Dec 16, 2024
1 parent f19604c commit 7698ae7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/widgets/Plotter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
persistent-hint
variant="outlined"
density="comfortable"
@update:model-value="changeDataLakeVariable"
/>
</div>
</v-col>
Expand Down Expand Up @@ -174,13 +173,12 @@ const cutExtraSamples = (): void => {
}
}
const changeDataLakeVariable = (newId: string): void => {
const changeDataLakeVariable = (newId: string, oldId?: string): void => {
if (newId === undefined) {
console.error('No data lake variable ID provided!')
return
}
const oldId = widget.value.options.dataLakeVariableId
if (oldId !== undefined && listenerId) {
unlistenDataLakeVariable(oldId, listenerId)
}
Expand All @@ -198,6 +196,14 @@ watch([widget.value.options.maxSamples, widget.value.options.limitSamples], () =
renderCanvas()
})
watch(
() => widget.value.options.dataLakeVariableId,
(newId, oldId) => {
changeDataLakeVariable(newId, oldId)
valuesHistory.length = 0
}
)
// Make canvas size follows window resizing
const { width: windowWidth, height: windowHeight } = useWindowSize()
const canvasSize = computed(() => ({
Expand Down

0 comments on commit 7698ae7

Please sign in to comment.