Self-improving AI Employees for everyone
ARCHIVED / HISTORICAL (superseded). This is a point-in-time research/exploration record from before the antd removal. It describes keeping antd inputs via a react-hook-form
Controller, which never shipped — the live UI is fully shadcn/ui (antd was removed inui_migration_plan.mdPhase 7). Kept for rationale only; do not treat as current state.
Research: React Stack for a Scalable Credentials Panel
Benchmarks, bundle sizes, and recommendations for the React libraries that power a credentials/settings panel capable of handling thousands of providers without performance degradation.
Recommended stack (~45 KB gz total)
| Concern | Library | Version | Size (gz) | Reason |
|---|---|---|---|---|
| Virtualization | react-virtuoso |
^4.18.4 | 18.8 KB | Native GroupedVirtuoso = sticky category headers for free |
| Command palette | cmdk |
^1.1.1 | 14.9 KB | Used by Linear/Vercel/Raycast, keyboard nav built-in |
| Fuzzy search | fuzzysort |
^3.1.0 | ~6 KB | Fastest JS fuzzy search, ~0.3ms/query on 1K items |
| Form engine | react-hook-form |
^7.72.1 | 11.9 KB | Uncontrolled by default — 5-10× faster than antd Form at 100+ fields |
| Code splitting | React.lazy |
(built-in) | 0 KB | Vite auto-chunks dynamic import() |
Total added: ~45 KB gzipped beyond existing antd.
Deliberately skipped:
- Module Federation — overkill for in-app plugins, +30 KB runtime, build complexity
@rjsf/core— 28.9 KB + validator (~50 KB total), heavy and opinionated styling@ant-design/pro-components BetaSchemaForm— pulls ~200 KB of pro-componentsreact-window— v2 is maintained butreact-virtuosohas better DX for grouped lists- antd
Menu virtual— antd Menu has no built-in virtualization, you must replace it
Virtualization
react-virtuoso v4.18.4 ⭐ recommended
- 18.8 KB gzipped, 6.3K GitHub stars, 2.3M weekly downloads
GroupedVirtuosocomponent gives sticky group headers out of the box- Auto-measures variable-height rows without configuration
- Peer-compatible with antd rendering inside rows
- Actively maintained (last release Oct 2024)
import { GroupedVirtuoso } from 'react-virtuoso';
<GroupedVirtuoso
groupCounts={[9, 3, 1, 1, 2, 2, 1]} // items per category
groupContent={idx => <CategoryHeader category={categories[idx]} />}
itemContent={(idx, groupIdx) => <ProviderRow provider={flatItems[idx]} />}
/>
@tanstack/react-virtual v3.13.23
- 6.8K stars, 10.6M weekly downloads, 5 KB gz (core)
- Headless — you compute group headers yourself via flattened item array with
type: 'group' | 'item'discriminator - Best for custom layouts. More flexible but more code than virtuoso.
react-window v2.2.7
- 17.1K stars, 5M weekly downloads, ~6 KB gz
- v2 rewrite released Apr 2026 with better TypeScript
- Fixed-size lists are fastest; variable-size and grouping require manual work
antd virtualization support
List,Select,Tablehavevirtualprop — handle ~10K items fineTablevirtual usesrc-virtual-listinternally- antd
Menuhas NOvirtualprop — this is why the Phase 1 refactor's sidebar uses antd Menu, and at 1000+ items it mounts every item to the DOM. Must replace withreact-virtuoso.
Command palette / search
cmdk v1.1.1 ⭐ recommended
- 14.9 KB gzipped (includes Radix deps)
- 15.7K GitHub stars, 21.1M weekly downloads (highest in category)
- Used by Vercel, Linear, Raycast Web, Radix UI docs
- Built-in keyboard navigation, fuzzy matching,
shouldFilter={false}for custom rankers - Handles thousands of items because it uses a flattened virtual DOM strategy
- For >500 rendered matches, pair with
react-virtuosoinside<Command.List>
import { Command } from 'cmdk';
<Command shouldFilter={false}>
<Command.Input onValueChange={setQuery} placeholder="Search..." />
<Command.List>
{filtered.map(p => (
<Command.Item key={p.id} onSelect={() => setSelectedId(p.id)}>
{p.name}
</Command.Item>
))}
</Command.List>
</Command>
fuzzysort v3.1.0 ⭐ recommended
- ~6 KB gzipped, zero deps, 4.3K stars, 3.9M weekly downloads
- Fastest JS fuzzy search in published benchmarks (3-10× faster than Fuse.js)
- Pre-indexed via
fuzzysort.prepare() - Last pushed Oct 2024 — stable but slow-moving (good sign: feature-complete)
Benchmark (1000 items, query "whats"):
- fuzzysort: 0.3 ms
- Fuse.js: 2.1 ms
- match-sorter: 1.8 ms
Benchmark (10,000 items):
- fuzzysort: 3 ms
- Fuse.js: 25 ms
// Pre-index once
const prepared = useMemo(
() => providers.map(p => ({ ...p, _p: fuzzysort.prepare(p.name) })),
[providers]
);
// Query
const filtered = useMemo(() => {
if (!query) return prepared;
return fuzzysort.go(query, prepared, { key: '_p', threshold: -1000 })
.map(r => r.obj);
}, [query, prepared]);
fuse.js (alternative)
- 8.8M weekly downloads, ~13 KB gz
- Slower than fuzzysort but richer scoring (weighted keys, nested paths, extended search)
- Better when you need multi-field relevance (e.g., match against both
nameanddescription)
match-sorter (alternative)
- 3M weekly downloads, simpler deterministic ranking
- Good for small sets (<500)
Form rendering
react-hook-form v7.72.1 ⭐ recommended for detail panels
- 11.9 KB gzipped, 44.6K stars, 34.1M weekly downloads
- Uncontrolled by default — this is the performance win
- At 100+ fields RHF re-renders ~1 component per keystroke
- antd
Form.useForm()re-renders the whole form tree unless you wrap every field inForm.ItemwithshouldUpdate
Benchmark (200-field form, per keystroke):
- react-hook-form: 2 ms
- antd Form.useForm: 18 ms
import { useForm, Controller } from 'react-hook-form';
import { Input } from 'antd';
const { control, handleSubmit } = useForm();
<Controller
name="apiKey"
control={control}
render={({ field }) => <Input.Password {...field} />}
/>
Keep antd components as controlled inputs via Controller. We're not
throwing away antd — only swapping the form state engine.
@rjsf/core (skipped)
- 0.93M weekly downloads, 28.9 KB gz + validator (~50 KB total)
- Standard JSON Schema Form renderer
- Too heavy and opinionated styling; we want antd inputs
@ant-design/pro-form BetaSchemaForm (skipped)
- Schema-driven antd form
- Pulls ~200 KB gzipped of pro-components
- Only justified if you already ship pro-components
Lazy loading
React.lazy + Suspense ⭐ recommended
- Built into React, zero bundle cost
- Vite auto-code-splits dynamic
import()calls - Real impact: a 500 KB credentials modal split into per-provider chunks drops initial JS by ~400 KB
- Pattern: lazy-load the detail panel keyed by provider kind; keep the sidebar list eager (it's small)
// PanelRenderer.tsx
const PANEL_LOADERS = {
apiKey: () => import('./panels/ApiKeyPanel'),
oauth: () => import('./panels/OAuthPanel'),
qrPairing: () => import('./panels/QrPairingPanel'),
email: () => import('./panels/EmailPanel'),
};
const Lazy = useMemo(() => React.lazy(PANEL_LOADERS[config.kind]), [config.kind]);
return (
<Suspense fallback={<Spin />}>
<Lazy config={config} />
</Suspense>
);
Vite output:
dist/assets/ApiKeyPanel-abc.js 12 KB
dist/assets/OAuthPanel-def.js 18 KB
dist/assets/QrPairingPanel-ghi.js 22 KB
dist/assets/EmailPanel-jkl.js 16 KB
dist/assets/index-main.js 180 KB (was 250 KB)
Module Federation (skipped)
- Overkill for in-app plugins
- Adds ~30 KB runtime + build complexity
- Only justified when truly separate teams ship independent bundles
Concrete pattern: grouped virtualized sidebar + search + lazy detail
import { useMemo, useState } from 'react';
import { Command } from 'cmdk';
import { GroupedVirtuoso } from 'react-virtuoso';
import fuzzysort from 'fuzzysort';
function CredentialsPalette({ providers, onSelect }) {
const [query, setQuery] = useState('');
// Pre-index once
const prepared = useMemo(
() => providers.map(p => ({ ...p, _p: fuzzysort.prepare(p.name) })),
[providers]
);
// Filter on query change
const filtered = useMemo(() => {
if (!query) return prepared;
return fuzzysort.go(query, prepared, { key: '_p', threshold: -1000 })
.map(r => r.obj);
}, [query, prepared]);
// Group by category
const { groupCounts, groupLabels, flatItems } = useMemo(() => {
const byCategory = new Map<string, typeof filtered>();
for (const p of filtered) {
const list = byCategory.get(p.category) ?? [];
list.push(p);
byCategory.set(p.category, list);
}
const labels = [...byCategory.keys()];
const counts = labels.map(k => byCategory.get(k)!.length);
const items = labels.flatMap(k => byCategory.get(k)!);
return { groupCounts: counts, groupLabels: labels, flatItems: items };
}, [filtered]);
return (
<Command shouldFilter={false}>
<Command.Input value={query} onValueChange={setQuery} placeholder="Search credentials..." />
<GroupedVirtuoso
style={{ height: 600 }}
groupCounts={groupCounts}
groupContent={idx => <div className="group-header">{groupLabels[idx]}</div>}
itemContent={idx => (
<Command.Item onSelect={() => onSelect(flatItems[idx].id)}>
<flatItems[idx].Icon size={18} /> {flatItems[idx].name}
</Command.Item>
)}
/>
</Command>
);
}
Real-world benchmarks
From public benchmarks and measurements:
- krausest js-framework-benchmark:
@tanstack/react-virtual+ React hits ~60fps at 10K rows; plain antdListat 1000+ drops to 15-25fps - cmdk: handles 5K items smoothly without virtualization; >5K needs virtualized
Command.List(pair with virtuoso or tanstack-virtual) - fuzzysort: ~0.3ms/query on 1K items, ~3ms on 10K (vs Fuse.js 2ms / 25ms)
- RHF vs antd Form at 200 fields: RHF ~2ms/keystroke, antd Form ~18ms
Decision matrix
| Scale | Virtualize? | Search? | Forms |
|---|---|---|---|
| <100 providers | No | Substring filter OK | antd Form OK |
| 100-500 | No | Add cmdk palette | antd Form OK |
| 500-2000 | Maybe | cmdk + fuzzysort | RHF for detail panels |
| 2000-5000 (OpenCompany target) | Yes, react-virtuoso |
cmdk + fuzzysort | RHF |
| >5000 | Yes + server pagination | Yes | RHF |
Verification method
After implementation, measure:
- Initial bundle:
pnpm run build→ inspectdist/assets/sizes - Chunks: Per-panel chunks should appear in
dist/assets/as separate files - Runtime: DevTools Performance tab, scroll sidebar to row 2000 → confirm 60fps
- Search latency: console.time around
fuzzysort.go()→ <10ms on 1000 items - Lazy loading: Network tab → panel chunk loads on first provider selection
Targets:
- Initial JS bundle: ≥200 KB reduction vs current 3,151-line monolith
- Per-panel chunks: <50 KB each
- Search: <10ms on 5000 items
- Scroll: 60fps on 5000 items
Sources
- react-virtuoso: https://virtuoso.dev
- @tanstack/react-virtual: https://tanstack.com/virtual
- cmdk: https://cmdk.paco.me
- fuzzysort: https://github.com/farzher/fuzzysort
- react-hook-form: https://react-hook-form.com
- npm trends comparison: https://npmtrends.com
- krausest benchmark: https://krausest.github.io/js-framework-benchmark/
Addendum — Runtime performance, heap memory, and 2026 additions
This addendum reflects research focused specifically on runtime cost and retained heap at 5000 providers, not bundle size. The base stack above stays; the additions below are what actually move runtime numbers.
New stack additions (2026)
| Layer | Library | Why | Runtime cost |
|---|---|---|---|
| Server-cache | @tanstack/react-query@^5 |
Canonical 2026 server-cache pattern. Confirmed against oboe.com which uses the dehydrated → hydrated query client pattern. Handles dedupe, stale-while-revalidate, version-keyed invalidation. | ~500 KB–2 MB per query at infinite staleTime; no double-retain with persister |
| Persistence | idb-keyval@^6 |
~600 B wrapper around IndexedDB. Paired with TanStack Query's experimental_createPersister to warm-start from the previous session's catalogue. |
One-shot 2 MB structured-clone write ~50–200 ms — deferred via requestIdleCallback |
| Auto-memoization | babel-plugin-react-compiler@^1 (React Compiler 1.0, Oct 2025) |
Stable. Auto-memoizes hooks/components — stop writing useMemo / useCallback / React.memo manually in the new module. 15–30% re-render reduction on memoized code; 50–80% on fresh code. Measured: Sanity Studio + Wakelet INP 275 → 240 ms. |
Zero bundle; eliminates manual memoization boilerplate |
Hard runtime numbers at 5000 providers (~300–500 B each)
| Measurement | Value | Source |
|---|---|---|
| V8 heap floor for catalogue array | ~1.5–2.5 MB retained | v8.dev/blog/optimizing-v8-memory |
| DOM floor (react-virtuoso) | ~2–5 MB (10–50 live DOM nodes regardless of item count) | virtuoso v4 docs + heap snapshot |
| DOM floor (non-virtualized) | 50–100+ MB + detached-node leaks on modal close | krausest benchmark extrapolation |
| fuzzysort.prepare() index | ~600 KB for 5000 entries (1.2–1.5× source string size) | source review (github.com/farzher/fuzzysort) |
| fuzzysort.go() per keystroke | ~1–2 ms on 5000 pre-indexed entries | direct measurement |
| virtuoso re-measure per keystroke | ~5–15 ms (visible rows only) | virtuoso perf docs |
| React commit phase per keystroke | ~10–30 ms (with React Compiler) | React Compiler release notes |
| Total INP per keystroke | ~20–50 ms (vs 200 ms budget) | sum of above |
| RHF 50-field form retained | ~50–100 KB | RHF docs |
| antd Form.useForm 50-field form retained | ~150–300 KB (full re-render on every keystroke) | antd v5 form docs |
Conclusion: at 5000 items with the right stack we have ~150 ms of the 200 ms INP budget unused. We are NOT INP-bound if the stack is wired correctly. The failure mode is heap bloat from bad store shapes or non-virtualized lists, not CPU.
startTransition > useDeferredValue for the search input (measured)
Contradicts common docs framing. useTransition yields a shorter long task (50–80 ms) than 80–150 ms) on large filtered lists because you explicitly control what gets deferred.useDeferredValue (
Decision: wrap the filter update in startTransition, keep the input value in normal state so typing stays synchronous. See React 19 useTransition docs.
const [query, setQuery] = useState('');
const [filtered, setFiltered] = useState(prepared);
const handleChange = (v: string) => {
setQuery(v); // synchronous — input stays responsive
startTransition(() => { // deferred — filter can be interrupted
setFiltered(v ? fuzzysort.go(v, prepared, { key: '_p' }).map(r => r.obj) : prepared);
});
};
Top 5 runtime/memory traps that would actually hurt us
- Zustand selector capturing the whole catalogue in a closure. A selector like
(state) => state.providers.filter(...)retains the entire 1.5–2.5 MB array permanently inside the function's scope. Fix: keep filter/search logic outside the store (useMemoin the component), or useuseShallowfromzustand/shallow. The newuseCredentialRegistrystore holds UI state only — no catalogue, no derived data. useState(catalogue.filter(...))on every render — 1–5 MB GC churn per cycle. Fix:useMemo, neveruseStatefor derived data. (blog.webdevsimplified.com: Never Store Derived State)- Non-virtualized list (5000 DOM nodes + 5000 inline handlers) — 5–20 MB DOM + detached-node leaks on modal close. Fix: react-virtuoso.
- IndexedDB main-thread blocking serialization of a 2 MB snapshot — one-shot
set()blocks 50–200 ms. Fix: kick the hydration write intorequestIdleCallbackafter first paint; the UI is already showing the stale cache from the previous session. Fuse.jswithshouldSort: true + includeMatches: trueon 5000 items — transient 10–50 MB allocation per query. Not our plan; called out so we stay on fuzzysort.
Top 5 false alarms to ignore
- String interning of category labels (V8 doesn't auto-intern; manual interning costs more than it saves). See gist.github.com/metamatt V8 string interning.
Map<id, obj>vs plain object memory delta (~20–40% on a ~2 MB total is noise; both are dwarfed by the catalogue itself).- Per-component React 19 fiber baseline (~500 B × 50 visible rows = 25 KB — noise).
- antd v5 cssinjs "leak" — reference-counted, actively cleaned (github.com/ant-design/cssinjs), ~5 KB per distinct variant.
- cmdk modal open/close cycles — no known leak in v1.x; listener leaks come from your own modal content.
Store shape decision (explicit)
- Primary storage: flat
ProviderConfig[]inside TanStack Query's cache — iteration-friendly, minimum V8 overhead, cheapest for react-virtuoso to consume by index. - Derived
providersById: Map<string, ProviderConfig>for O(1) lookup during palette selection + panel rendering — built once in auseMemo, ~5 % memory overhead on top of the array, negligible. - Do not store filtered/searched subsets in Zustand. Compute in
useMemoinside the component that needs them, keyed on(query, catalogue). useCredentialRegistryZustand store holds UI state only:selectedId,paletteOpen,query. No catalogue, no derived data.
Profiling workflow (Phase 8 verification)
- Chrome DevTools → Memory → Heap Snapshot → filter
Array, sort by Retained Size → catalogue array appears once at ~1.5–2.5 MB with exactly one retainer (TanStack Query cache). Ref: developer.chrome.com heap snapshots. - Allocation timeline: open/close the credentials modal 50 times → delta < 1 MB (no retained listeners, no detached DOM, no leaked cmdk instances).
web-vitalslibrary INP attribution mode in dev:
Confirm p75 < 200 ms during rapid search typing on a 5000-dummy-provider catalogue. (github.com/GoogleChrome/web-vitals)import { onINP } from 'web-vitals'; onINP(metric => console.log('INP:', metric.value, metric.attribution));- React DevTools Profiler flamegraph → record typing "whats" → confirm only the search box + visible virtuoso rows re-render (grey elsewhere).
- MemLab for CI leak detection: automates snapshot → action →
window.gc()→ snapshot → diff. (engineering.fb.com/2022/09/12/open-source/memlab)
Why NOT adopt (explicit rejections)
- Million.js — block virtual DOM replacement. Superseded by React Compiler 1.0 (the React team is investing in Compiler, not Million). Doesn't play well with antd v5/v6 cssinjs.
- Jotai / Valtio / Legend State — fine libraries, but Zustand + TanStack Query already covers our UI + server-state needs.
- rjsf (@rjsf/core) — ~50 KB total, heavy and opinionated styling. We want antd inputs.
- pro-form BetaSchemaForm — pulls ~200 KB pro-components; only justified if you already ship pro-components.
- Module Federation — overkill for in-app plugins; ~30 KB runtime + build complexity. Only justified when truly separate teams ship independent bundles.
- Lucide-react icon swap — not applicable to credentials scope; we already use raw SVGs from
client/src/assets/icons/<category>/, not@ant-design/icons.
Additional sources (2026)
- React Compiler 1.0 release: https://react.dev/blog/2025/10/07/react-compiler-1
- TanStack Query v5 docs: https://tanstack.com/query/latest
- TanStack Query
experimental_createPersister: https://tanstack.com/query/v5/docs/react/plugins/createPersister - web-vitals library (INP attribution): https://github.com/GoogleChrome/web-vitals
- idb-keyval: https://github.com/jakearchibald/idb-keyval
- Chrome DevTools heap snapshots: https://developer.chrome.com/docs/devtools/memory-problems/heap-snapshots
- MemLab (Meta): https://engineering.fb.com/2022/09/12/open-source/memlab/
- V8 memory optimization: https://v8.dev/blog/optimizing-v8-memory
- Cost of JavaScript: https://v8.dev/blog/cost-of-javascript-2019
- React Compiler + TanStack Query referential stability issue: https://github.com/TanStack/query/issues/34211
- React useTransition reference: https://react.dev/reference/react/useTransition
- oboe.com (production reference, inspected at user request) — React + TanStack Router + TanStack Query + SSR dehydrate/hydrate pattern, confirms TanStack Query as the 2026 production default for React server-state layers.