fix: Undo after applying new preset

This commit is contained in:
Sahaj Jain
2025-05-15 11:21:32 +05:30
committed by Sahaj Jain
parent 9bd8148e5b
commit a96bef47e7
+1 -5
View File
@@ -81,10 +81,6 @@ export const useEditorStore = create<EditorStore>()(
currentHistory.shift(); // Remove the oldest entry
}
console.log(
"currentHistory",
currentHistory?.map((h) => h.timestamp)
);
set({
themeState: newState,
history: currentHistory,
@@ -104,7 +100,7 @@ export const useEditorStore = create<EditorStore>()(
hslAdjustments: defaultThemeState.hslAdjustments,
};
const newHistoryEntry = { state: currentThemeState, timestamp: currentTime };
const newHistoryEntry = { state: newThemeState, timestamp: currentTime };
let updatedHistory = [...oldHistory, newHistoryEntry];
if (updatedHistory.length > MAX_HISTORY_COUNT) {
updatedHistory.shift();