mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
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:
@@ -1627,16 +1627,18 @@ export const useAppStore = create<AppState & AppActions>()((set, get) => ({
|
||||
const updatedProjects = projects.map((p) => (p.id === existingProject.id ? project : p));
|
||||
set({ projects: updatedProjects });
|
||||
} else {
|
||||
// Create new project - check for trashed project with same path first (preserves theme if deleted/recreated)
|
||||
// Then fall back to provided theme, then current project theme, then global theme
|
||||
// Create new project - only set theme if explicitly provided or recovering from trash
|
||||
// Otherwise leave undefined so project uses global theme ("Use Global Theme" checked)
|
||||
const trashedProject = trashedProjects.find((p) => p.path === path);
|
||||
const effectiveTheme = theme || trashedProject?.theme || currentProject?.theme || globalTheme;
|
||||
const projectTheme =
|
||||
theme !== undefined ? theme : (trashedProject?.theme as ThemeMode | undefined);
|
||||
|
||||
project = {
|
||||
id: `project-${Date.now()}`,
|
||||
name,
|
||||
path,
|
||||
lastOpened: new Date().toISOString(),
|
||||
theme: effectiveTheme,
|
||||
theme: projectTheme, // May be undefined - intentional!
|
||||
};
|
||||
// Add the new project to the store
|
||||
set({
|
||||
|
||||
Reference in New Issue
Block a user