Skip to content

A local-first personal finance app

:recycle: (synced-prefs) remove no longer necessary migration (#3718)

Matiss Janis Aboltins34f3ccacf622
diff --git a/packages/desktop-client/src/hooks/useLocalPref.ts b/packages/desktop-client/src/hooks/useLocalPref.ts
index 3da16da937..d5c236cc76 100644
--- a/packages/desktop-client/src/hooks/useLocalPref.ts
+++ b/packages/desktop-client/src/hooks/useLocalPref.ts
@@ -1,5 +1,3 @@
-import { useEffect } from 'react';
-
import { useLocalStorage } from 'usehooks-ts';
import { type LocalPrefs } from 'loot-core/src/types/prefs';
@@ -18,25 +16,8 @@ export function useLocalPref<K extends keyof LocalPrefs>(
): [LocalPrefs[K], SetLocalPrefAction<K>] {
const [budgetId] = useMetadataPref('id');
- const [value, setValue] = useLocalStorage<LocalPrefs[K]>(
- `${budgetId}-${prefName}`,
- undefined,
- {
- deserializer: JSON.parse,
- serializer: JSON.stringify,
- },
- );
-
- // Migrate from old pref storage location (metadata.json) to local storage
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const [metadataPref] = useMetadataPref(prefName as any);
- useEffect(() => {
- if (value !== undefined || metadataPref === undefined) {
- return;
- }
-
- setValue(metadataPref);
- }, [value, metadataPref, setValue]);
-
- return [value, setValue];
+ return useLocalStorage<LocalPrefs[K]>(`${budgetId}-${prefName}`, undefined, {
+ deserializer: JSON.parse,
+ serializer: JSON.stringify,
+ });
}
diff --git a/upcoming-release-notes/3718.md b/upcoming-release-notes/3718.md
new file mode 100644
index 0000000000..a62702a592
--- /dev/null
+++ b/upcoming-release-notes/3718.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [MatissJanis]
+---
+
+SyncedPrefs: remove no longer necessary migration.