Skip to content

Commit

Permalink
Do not use deep watcher in time series data
Browse files Browse the repository at this point in the history
  • Loading branch information
ceesvoesenek authored and wkramer committed Jun 20, 2024
1 parent 0414789 commit 8f6c6a6
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/components/table/TimeSeriesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,7 @@ interface Props {
series: Record<string, Series>
}
const props = withDefaults(defineProps<Props>(), {
config: () => {
return {
title: '',
series: [],
}
},
series: () => {
return {}
},
})
const props = defineProps<Props>()
const itemsPerPageOptions = [
{ value: 200, title: '200' },
Expand Down Expand Up @@ -277,7 +267,12 @@ watch(
)
watchDebounced(
props.series,
// We cannot use a getter on props.series directly here, since it is not
// reassigned, but instead its contents are modified. We also do not want to
// use a deep watcher, because it would watch the entire contents of the
// series for changes, which is rather inefficient. Instead, we watch an array
// of last updated dates.
() => Object.values(props.series).map((series) => series.lastUpdated),
() => {
if (props.series === undefined) return
tableData.value = createTableData(
Expand Down

0 comments on commit 8f6c6a6

Please sign in to comment.