Skip to content

Commit b4ce0e0

Browse files
hipsterusernamepsychedelicious
authored andcommitted
lint
1 parent d6442d9 commit b4ce0e0

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,7 @@ const slice = createSlice({
199199
return;
200200
}
201201

202-
203-
state.positivePromptHistory = [
204-
prompt,
205-
...state.positivePromptHistory.filter((p) => p !== prompt),
206-
];
202+
state.positivePromptHistory = [prompt, ...state.positivePromptHistory.filter((p) => p !== prompt)];
207203

208204
if (state.positivePromptHistory.length > MAX_POSITIVE_PROMPT_HISTORY) {
209205
state.positivePromptHistory = state.positivePromptHistory.slice(0, MAX_POSITIVE_PROMPT_HISTORY);

invokeai/frontend/web/src/features/parameters/components/Core/ParamPositivePrompt.tsx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ export const ParamPositivePrompt = memo(() => {
117117

118118
// Compute a starting working history and ensure current prompt is bumped into history
119119
const startBrowsing = useCallback(() => {
120-
if (browsingIndexRef.current !== null) return;
120+
if (browsingIndexRef.current !== null) {
121+
return;
122+
}
121123
preBrowsePromptRef.current = prompt ?? '';
122124
const trimmedCurrent = (prompt ?? '').trim();
123125
if (trimmedCurrent) {
@@ -129,13 +131,17 @@ export const ParamPositivePrompt = memo(() => {
129131
const applyHistoryAtIndex = useCallback(
130132
(idx: number, placeCaretAt: 'start' | 'end') => {
131133
const list = history;
132-
if (list.length === 0) return;
134+
if (list.length === 0) {
135+
return;
136+
}
133137
const clamped = Math.max(0, Math.min(idx, list.length - 1));
134138
browsingIndexRef.current = clamped;
135139
dispatch(positivePromptChanged(list[clamped]));
136140
requestAnimationFrame(() => {
137141
const el = textareaRef.current;
138-
if (!el) return;
142+
if (!el) {
143+
return;
144+
}
139145
if (placeCaretAt === 'start') {
140146
el.selectionStart = 0;
141147
el.selectionEnd = 0;
@@ -150,8 +156,12 @@ export const ParamPositivePrompt = memo(() => {
150156
);
151157

152158
const browsePrev = useCallback(() => {
153-
if (!isPromptFocused()) return;
154-
if (history.length === 0) return;
159+
if (!isPromptFocused()) {
160+
return;
161+
}
162+
if (history.length === 0) {
163+
return;
164+
}
155165
if (browsingIndexRef.current === null) {
156166
startBrowsing();
157167
// Move to older entry on first activation
@@ -168,8 +178,12 @@ export const ParamPositivePrompt = memo(() => {
168178
}, [applyHistoryAtIndex, history.length, isPromptFocused, startBrowsing]);
169179

170180
const browseNext = useCallback(() => {
171-
if (!isPromptFocused()) return;
172-
if (history.length === 0) return;
181+
if (!isPromptFocused()) {
182+
return;
183+
}
184+
if (history.length === 0) {
185+
return;
186+
}
173187
if (browsingIndexRef.current === null) {
174188
// Not browsing; Down does nothing (matches shell semantics)
175189
return;

invokeai/frontend/web/src/features/parameters/components/Core/PositivePromptHistory.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ const PromptHistoryContent = memo(() => {
119119
</Flex>
120120
<Flex alignItems="center" justifyContent="center" pt={1}>
121121
<Text fontSize="xs" color="base.400" textAlign="center">
122-
<Text as="span" fontWeight="semibold">Alt + Up/Down</Text> to switch between prompts.
122+
<Text as="span" fontWeight="semibold">
123+
Alt + Up/Down
124+
</Text>{' '}
125+
to switch between prompts.
123126
</Text>
124127
</Flex>
125128
</Flex>

0 commit comments

Comments
 (0)