diff --git a/apps/ai-game-creator-shell/src/features/ui-editor/useUiEditorState.ts b/apps/ai-game-creator-shell/src/features/ui-editor/useUiEditorState.ts index f15be0431..2ef8569e5 100644 --- a/apps/ai-game-creator-shell/src/features/ui-editor/useUiEditorState.ts +++ b/apps/ai-game-creator-shell/src/features/ui-editor/useUiEditorState.ts @@ -33,6 +33,8 @@ export const EMPTY_UI_EDITOR_STATE: State = { font_assets: {}, }; +const MAX_HISTORY_LENGTH = 100; + export type UiEditorOperationFailureReason = | 'locked' | 'duplicate' @@ -567,7 +569,7 @@ export function useUiEditorState(initialState: State = EMPTY_UI_EDITOR_STATE) { before: cloneState(current), after: cloneState(nextState), }); - if (undoStackRef.current.length > 100) { + if (undoStackRef.current.length > MAX_HISTORY_LENGTH) { undoStackRef.current.shift(); } redoStackRef.current = [];