Open source personal finance application
refactor: replace JSON.stringify with stable key in useStatConfig storage key
Ilya Komichev4b8932c5f250
diff --git a/app/components/stat/useStatConfig.ts b/app/components/stat/useStatConfig.tsindex b2e25476..c54a0ccc 100644--- a/app/components/stat/useStatConfig.ts+++ b/app/components/stat/useStatConfig.ts@@ -54,7 +54,11 @@ type StatConfigParams = {}export function useStatConfig({ props, storageKey }: StatConfigParams) {- const newBaseStorageKey = computed(() => `finapp-${storageKey}-${JSON.stringify(useRouter().currentRoute.value.query)}`)+ const newBaseStorageKey = computed(() => {+ const query = useRouter().currentRoute.value.query+ const queryKey = Object.entries(query).map(([k, v]) => `${k}=${v}`).join('&')+ return `finapp-${storageKey}-${queryKey}`+ })const config = useStorage<MiniItemConfig>(newBaseStorageKey.value, {catsList: {