fix: prevent new projects from overriding global theme setting

When creating new projects, the theme was always explicitly set even when
matching the global theme. This caused "Use Global Theme" to be unchecked,
preventing global theme changes from affecting the project.

Now theme is only set on new projects when explicitly provided or when
recovering a trashed project's theme preference.
This commit is contained in:
Stefan de Vogelaere
2026-01-18 16:12:32 +01:00
parent 96202d4bc2
commit 75fe579e93
6 changed files with 35 additions and 102 deletions

View File

@@ -24,10 +24,10 @@ export function ThemeStep({ onNext, onBack }: ThemeStepProps) {
const handleThemeClick = (themeValue: string) => {
setTheme(themeValue as typeof theme);
// Also update the current project's theme if one exists
// This ensures the selected theme is visible since getEffectiveTheme() prioritizes project theme
if (currentProject) {
setProjectTheme(currentProject.id, themeValue as typeof theme);
// Clear the current project's theme so it uses the global theme
// This ensures "Use Global Theme" is checked and the project inherits the global theme
if (currentProject && currentProject.theme !== undefined) {
setProjectTheme(currentProject.id, null);
}
setPreviewTheme(null);
};