Repository navigation
chore(app): drop remeda from app and ui - #59016
Conversation
There was a problem hiding this comment.
Looks good. On 2,000 random inputs (tied dates, missing families, free/paid twins, numeric and empty categories, duplicate keys), the new latestModels, uniqueModels and groupItems give the same output as the remeda versions. test:unit passes in packages/app (768) and bun test src in packages/ui (157), and tsc is clean in both. Map.groupBy is already used elsewhere in the app, so it adds no new runtime requirement.
The new models.test.ts only passes through the package's test:unit script (--conditions=solid). A bare bun test in packages/app fails at import with solid-sonner's "Client-only API" error. That matches how the package runs its tests, so it is not a blocker.
Public API: unchanged (internal app/ui code and dependencies only).
What it does
Removes
remedafrompackages/appandpackages/ui. It was used in two places for a handful of group, first and unique helpers that native array methods cover. (tui,webandgui-extensionsstill use it.)How it works
ui/src/hooks/use-filtered-list.tsx: grouping moves to an exportedgroupItems. It builds a plain object and reads it withObject.entries, so group order is unchanged, including numeric-looking categories listed first.app/src/providers/models/models.tsx:latestModelsusesMap.groupByper provider and perfamily:isFree, then picks the newestrelease_datewith areducethat only replaces on a strictly greater date. Ties keep the first model, likefirstBy.uniqueModelskeeps the first of each key in order, likeuniqueBy.Risk
The model picker's default visible models, its recent list, and the grouping and order of filtered lists (pickers and menus built on
useFilteredList). The old and new code were compared on 500 random inputs (groups with numeric and negative keys, tied dates, duplicate keys) and gave identical results; that script was not committed. Provider order insidelatestModelscould differ only for integer-like provider ids, and the result is only used as a set.Proof
bun test srcinpackages/ui: 157 pass, with newgroupItemstests.bun test ./src/providersinpackages/app: 37 pass, with new tests for the tie, free/paid grouping and uniqueness.bun typecheckinpackages/uiandpackages/app: clean.bun script/lint-changed.ts origin/dev: 0 problems.