mirror of
https://github.com/soconnor0919/beenvoice.git
synced 2026-02-05 00:06:36 -05:00
fix: Ensure color theme syncs correctly by updating useEffect dependencies, refactor email base URL assignment, and add baseline-browser-mapping dependency.
This commit is contained in:
@@ -49,12 +49,7 @@ export function ColorThemeProvider({
|
||||
|
||||
const updateThemeMutation = api.settings.updateTheme.useMutation();
|
||||
|
||||
// Sync from DB when available
|
||||
React.useEffect(() => {
|
||||
if (dbTheme) {
|
||||
setColorTheme(dbTheme.colorTheme, dbTheme.customColor);
|
||||
}
|
||||
}, [dbTheme]);
|
||||
|
||||
|
||||
const setColorTheme = React.useCallback(
|
||||
(theme: ColorTheme, customColor?: string) => {
|
||||
@@ -131,6 +126,13 @@ export function ColorThemeProvider({
|
||||
[modeTheme, defaultColorTheme],
|
||||
);
|
||||
|
||||
// Sync from DB when available
|
||||
React.useEffect(() => {
|
||||
if (dbTheme) {
|
||||
setColorTheme(dbTheme.colorTheme, dbTheme.customColor);
|
||||
}
|
||||
}, [dbTheme, setColorTheme]);
|
||||
|
||||
// Effect to trigger DB update when state changes (debounced or direct)
|
||||
// We do this separately to avoid putting mutation in the setColorTheme callback dependencies if possible
|
||||
// But actually, calling it in setColorTheme is better for direct user action.
|
||||
|
||||
Reference in New Issue
Block a user