Skip to content

Commit 2aec29c

Browse files
fix(ui): dedupe prompt history
1 parent b0aa48d commit 2aec29c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

invokeai/frontend/web/src/features/controlLayers/store/paramsSlice.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { RootState } from 'app/store/store';
44
import type { SliceConfig } from 'app/store/types';
55
import { deepClone } from 'common/util/deepClone';
66
import { roundDownToMultiple, roundToMultiple } from 'common/util/roundDownToMultiple';
7-
import { isPlainObject, uniq } from 'es-toolkit';
7+
import { isPlainObject } from 'es-toolkit';
88
import { clamp } from 'es-toolkit/compat';
99
import type { AspectRatioID, ParamsState, RgbaColor } from 'features/controlLayers/store/types';
1010
import {
@@ -198,10 +198,11 @@ const slice = createSlice({
198198
if (prompt.length === 0) {
199199
return;
200200
}
201-
// Remove if already exists
202-
state.positivePromptHistory = uniq(state.positivePromptHistory);
203201

204-
// Add to front
202+
if (state.positivePromptHistory.includes(prompt)) {
203+
return;
204+
}
205+
205206
state.positivePromptHistory.unshift(prompt);
206207

207208
if (state.positivePromptHistory.length > MAX_POSITIVE_PROMPT_HISTORY) {

0 commit comments

Comments
 (0)