mirror of
https://github.com/multipleof4/ntfy.git
synced 2026-10-16 08:27:55 +00:00
Undo theme weirdness
This commit is contained in:
@@ -43,7 +43,7 @@ import accountApi, { Permission, Role } from "../app/AccountApi";
|
|||||||
import { Pref, PrefGroup } from "./Pref";
|
import { Pref, PrefGroup } from "./Pref";
|
||||||
import AccountContext from "./AccountContext";
|
import AccountContext from "./AccountContext";
|
||||||
import { Paragraph } from "./styles";
|
import { Paragraph } from "./styles";
|
||||||
import prefs, { THEME, THEME_LOCALSTORAGE_KEY } from "../app/Prefs";
|
import prefs, { THEME } from "../app/Prefs";
|
||||||
import { PermissionDenyAll, PermissionRead, PermissionReadWrite, PermissionWrite } from "./ReserveIcons";
|
import { PermissionDenyAll, PermissionRead, PermissionReadWrite, PermissionWrite } from "./ReserveIcons";
|
||||||
import { ReserveAddDialog, ReserveDeleteDialog, ReserveEditDialog } from "./ReserveDialogs";
|
import { ReserveAddDialog, ReserveDeleteDialog, ReserveEditDialog } from "./ReserveDialogs";
|
||||||
import { UnauthorizedError } from "../app/errors";
|
import { UnauthorizedError } from "../app/errors";
|
||||||
@@ -230,10 +230,7 @@ const DeleteAfter = () => {
|
|||||||
const Theme = () => {
|
const Theme = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const labelId = "prefTheme";
|
const labelId = "prefTheme";
|
||||||
// Reuse the same localStorage key Prefs already mirrors for the splash (THEME_LOCALSTORAGE_KEY),
|
const theme = useCachedPref(() => prefs.theme(), "pref.theme", THEME.SYSTEM);
|
||||||
// rather than a second cache key, so the value isn't stored twice. The cached value renders the
|
|
||||||
// dropdown instantly; the live query then confirms it from IndexedDB.
|
|
||||||
const theme = useLiveQuery(() => prefs.theme()) ?? localStorage.getItem(THEME_LOCALSTORAGE_KEY) ?? THEME.SYSTEM;
|
|
||||||
const handleChange = async (ev) => {
|
const handleChange = async (ev) => {
|
||||||
await prefs.setTheme(ev.target.value);
|
await prefs.setTheme(ev.target.value);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user