refactor(settings): drop two query keys nothing reads

The unit-system and glucose-unit selects invalidated
`userUnitPreference()` and `userGlucoseUnit()` after a save, but no
query was ever registered under either key; every surface reads the
units from the account payload, which both selects already refresh.
This commit is contained in:
Marc-André Bombeck committed 2026-11-11 22:20:53 +01:00
1 parent 5552a9b149
commit 0c07764097
4 files changed
+7 -31

No files matched your search

@@ -29,9 +29,9 @@ import { resolveGlucoseUnit, type GlucoseUnit } from "@/lib/glucose";
* locale.
*
* Persistence mirrors the unit-system select: a change PATCHes
* `/api/auth/me/glucose-unit` immediately and invalidates `queryKeys.authMe()`
* plus `queryKeys.userGlucoseUnit()`, so the dashboard tiles, the glucose
* insight page and the targets panel re-render on the next /me refetch.
* `/api/auth/me/glucose-unit` immediately and invalidates `queryKeys.authMe()`,
* so the dashboard tiles and the glucose insight page re-render on the next
* /me refetch.
*/
export function GlucoseUnitSelect({
isAuthenticated,
@@ -66,9 +66,6 @@ export function GlucoseUnitSelect({
onSuccess: () => {
toastWrittenOutcome("success", t("settings.dashboard.glucoseUnit.saved"));
queryClient.invalidateQueries({ queryKey: queryKeys.authMe() });
queryClient.invalidateQueries({
queryKey: queryKeys.userGlucoseUnit(),
});
setOptimistic(null);
},
onError: (err) => {
@@ -23,9 +23,8 @@ type UnitPreference = "metric" | "imperial";
* picker rather than in a standalone card (it replaces the retired
* `<UnitPreferenceCard>`). Persistence is unchanged: a change PATCHes
* `/api/auth/me/unit-preference` immediately and invalidates
* `queryKeys.authMe()` + `queryKeys.userUnitPreference()` so every chart
* display transform (km/h vs mph, km vs mi) re-renders on the next /me
* refetch — no manual reload, no contract change.
* `queryKeys.authMe()`, the account payload every chart display transform
* (km/h vs mph, km vs mi) reads, so they re-render on the next /me refetch.
*/
export function UnitPreferenceSelect({
isAuthenticated,
@@ -59,9 +58,6 @@ export function UnitPreferenceSelect({
onSuccess: () => {
toastWrittenOutcome("success", t("settings.dashboard.units.saved"));
queryClient.invalidateQueries({ queryKey: queryKeys.authMe() });
queryClient.invalidateQueries({
queryKey: queryKeys.userUnitPreference(),
});
setOptimistic(null);
},
onError: (err) => {