Open source personal finance application
fix: self-referencing computed in useStatItem and type mismatch in getTypesMapping
Ilya Komicheve4ffc132ecc4
diff --git a/app/components/stat/useStatItem.ts b/app/components/stat/useStatItem.tsindex 553682db..7ce3b2ac 100644--- a/app/components/stat/useStatItem.ts+++ b/app/components/stat/useStatItem.ts@@ -40,7 +40,7 @@ export function useStatItem({const { addMarkArea, createSeriesItem } = useStatChart()const newBaseStorageKey = computed(() =>- `finapp-${statDate.params.value.intervalsBy}-${storageKey.value}-${JSON.stringify(filter?.categoriesIds?.value)}`,+ `finapp-${statDate.params.value.intervalsBy}-${storageKey.value}-${(filter?.categoriesIds?.value ?? []).join(',')}`,)const filteredType = useStorage<SeriesSlugSelected>(@@ -55,7 +55,7 @@ export function useStatItem({const selectedTypesMapping = computed(() => getTypesMapping(selectedType.value))const isPeriodOneDay = computed(() => isPeriodOneDayFn(statDate.params.value))- const isIntervalSelected = computed(() => isIntervalSelected.value)+ const isIntervalSelected = computed(() => statDate.params.value.intervalSelected >= 0)const rangeTrnsIds = computed(() => trnsStore.getStoreTrnsIds({trnsIds: trnsIds.value,diff --git a/app/components/stat/utils.ts b/app/components/stat/utils.tsindex 7ed3806d..a14313db 100644--- a/app/components/stat/utils.ts+++ b/app/components/stat/utils.ts@@ -2,10 +2,11 @@ import type { SeriesSlugSelected, StatTabSlug } from '~/components/stat/types'import { TrnType } from '~/components/trns/types'-export function getTypesMapping(slug: StatTabSlug): TrnType[] | undefined {- const typeMapping: Record<StatTabSlug, TrnType[]> = {+export function getTypesMapping(slug: SeriesSlugSelected | StatTabSlug): TrnType[] | undefined {+ const typeMapping: Record<string, TrnType[]> = {expense: [TrnType.Expense, TrnType.Transfer],income: [TrnType.Income, TrnType.Transfer],+ netIncome: [TrnType.Expense, TrnType.Income, TrnType.Transfer],split: [TrnType.Expense, TrnType.Income, TrnType.Transfer],summary: [TrnType.Expense, TrnType.Income, TrnType.Transfer],}