History

Normalize branch and model selection handling

- Deduplicate terminal IDs and favorite model slugs with trim-aware iteration - Use effect-based filtering for local branch and built-in model lists - Switch stable array handling to non-mutating `toSorted`

Julius Marminge committed 6 months ago

Commit 7793bd61 parent 7f03f4d8 files · +63 −23Browse files

Showing the changes to apps/web/src/components/ChatView.tsx (1 of 8 files). Show all

Unified · Split

apps/web/src/components/ChatView.tsx+3−2
@@ -194,6 +194,7 @@ import { · 193 unmodified lines
194194 isVersionMismatchDismissed,
195195 resolveServerConfigVersionMismatch,
196196 } from "../versionSkew";
197+import { equals } from "effect/Equal";
197198
198199 const IMAGE_ONLY_BOOTSTRAP_PROMPT =
199200 "[User attached one or more images without additional text. Respond using the conversation context and the attached image(s).]";
@@ -438,8 +439,8 @@ function terminalIdListsEqual(left: readonly string[], right: readonly string[]) · 238 unmodified lines
438439 if (left.length === 0) {
439440 return true;
440441 }
441− const sortedLeft = [...left].sort((a, b) => a.localeCompare(b));
442− const sortedRight = [...right].sort((a, b) => a.localeCompare(b));
442+ const sortedLeft = left.toSorted((a, b) => a.localeCompare(b));
443+ const sortedRight = right.toSorted((a, b) => a.localeCompare(b));
443444 for (let index = 0; index < sortedLeft.length; index += 1) {
444445 if (sortedLeft[index] !== sortedRight[index]) {
445446 return false;