fix bug where chart does not update project colors on data change

This commit is contained in:
Gregor Vostrak
2024-09-17 16:56:02 +02:00
committed by Constantin Graf
parent b2ad4b3785
commit 36cdae523f

View File

@@ -15,6 +15,7 @@ import { getRandomColorWithSeed } from '@/packages/ui/src/utils/color';
import type { GroupedDataEntries } from '@/packages/api/src'; import type { GroupedDataEntries } from '@/packages/api/src';
import { useReportingStore } from '@/utils/useReporting'; import { useReportingStore } from '@/utils/useReporting';
import { useProjectsStore } from '@/utils/useProjects'; import { useProjectsStore } from '@/utils/useProjects';
import { storeToRefs } from 'pinia';
use([ use([
CanvasRenderer, CanvasRenderer,
@@ -32,7 +33,7 @@ const props = defineProps<{
type: string | null; type: string | null;
}>(); }>();
const { getNameForReportingRowEntry, emptyPlaceholder } = useReportingStore(); const { getNameForReportingRowEntry, emptyPlaceholder } = useReportingStore();
const { projects } = useProjectsStore(); const { projects } = storeToRefs(useProjectsStore());
const groupChartData = computed(() => { const groupChartData = computed(() => {
return ( return (
@@ -43,7 +44,7 @@ const groupChartData = computed(() => {
color = '#CCCCCC'; color = '#CCCCCC';
} else if (props.type === 'project') { } else if (props.type === 'project') {
color = color =
projects.find((project) => project.id === entry.key) projects.value?.find((project) => project.id === entry.key)
?.color ?? '#CCCCCC'; ?.color ?? '#CCCCCC';
} }
return { return {