Repository navigation
[codex] add settings search command palette - #140
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/src/components/AdminSectionCommandDialog.tsx`:
- Around line 35-37: Replace use of `href` as the unique identifier with a
stable per-result identity: change the `resultIndexByHref` mapping to use a
unique id field (e.g., `result.id`) or a generated stable id stored on each
result, and update all places that rely on `href` (the `resultIndexByHref` map,
selection logic that reads/writes selection state, ARIA id generation, and React
element `key` usage in the component methods referenced) to use that stable id
instead; ensure any fallback generation attaches the stable id to the result
objects so every reference (selection mapping, aria-owns/aria-controls ids, and
React keys) uses the same unique symbol (e.g., `resultId`) rather than `href`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2db12f1c-8d9e-431d-bce8-122d14d53650
📒 Files selected for processing (13)
web/src/components/AdminSectionCommandDialog.test.tsxweb/src/components/AdminSectionCommandDialog.tsxweb/src/components/AdminSidebar.tsxweb/src/components/settings/SettingsSearchInput.tsxweb/src/components/settings/settingsSearch.test.tsweb/src/components/settings/settingsSearch.tsweb/src/lib/adminNavigation.tsweb/src/lib/adminSettingsSearch.tsweb/src/pages/AdminDashboard.tsxweb/src/pages/SettingsLayout.test.tsxweb/src/pages/SettingsLayout.tsxweb/src/pages/admin-settings/AdminSettingsLayout.test.tsxweb/src/pages/admin-settings/AdminSettingsLayout.tsx
| const resultIndexByHref = useMemo( | ||
| () => new Map(results.map((item, index) => [item.href, index])), | ||
| [results], |
There was a problem hiding this comment.
Use a stable per-result identity instead of href as the unique key.
Line 35 indexes results by href, and Lines 167/215/247 also treat href as unique. If two
results share the same href, selection mapping and ARIA ids collide (and React keys duplicate).
Suggested fix
- const resultIndexByHref = useMemo(
- () => new Map(results.map((item, index) => [item.href, index])),
+ const resultIndexByItem = useMemo(
+ () => new Map(results.map((item, index) => [item, index] as const)),
[results],
);
@@
- aria-activedescendant={selectedResult ? resultId(selectedResult.href) : undefined}
+ aria-activedescendant={
+ selectedResult ? resultId(selectedResult.href, selectedIndex) : undefined
+ }
@@
- const index = resultIndexByHref.get(item.href) ?? -1;
+ const index = resultIndexByItem.get(item) ?? -1;
@@
- key={item.href}
+ key={resultId(item.href, index)}
item={item}
+ resultIndex={index}
@@
-function AdminCommandResultRow({
+function AdminCommandResultRow({
item,
+ resultIndex,
@@
onPick,
}: {
item: AdminNavItem;
+ resultIndex: number;
@@
- id={resultId(item.href)}
+ id={resultId(item.href, resultIndex)}
@@
-function resultId(href: string) {
- return `admin-command-${href.replace(/[^a-z0-9]+/gi, "-")}`;
+function resultId(href: string, index: number) {
+ return `admin-command-${index}-${href.replace(/[^a-z0-9]+/gi, "-")}`;
}Also applies to: 164-168, 215-216, 247-248
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/components/AdminSectionCommandDialog.tsx` around lines 35 - 37,
Replace use of `href` as the unique identifier with a stable per-result
identity: change the `resultIndexByHref` mapping to use a unique id field (e.g.,
`result.id`) or a generated stable id stored on each result, and update all
places that rely on `href` (the `resultIndexByHref` map, selection logic that
reads/writes selection state, ARIA id generation, and React element `key` usage
in the component methods referenced) to use that stable id instead; ensure any
fallback generation attaches the stable id to the result objects so every
reference (selection mapping, aria-owns/aria-controls ids, and React keys) uses
the same unique symbol (e.g., `resultId`) rather than `href`.
[codex] add settings search command palette
Summary
Why
The dashboard command search originally only knew about top-level admin sections. It now indexes the detailed admin settings metadata as well, so searches like
Pool Max Openresolve directly to the Database settings tab.Validation
pnpm --dir web exec vitest run src/components/AdminSectionCommandDialog.test.tsx src/components/AdminSidebar.test.tsx src/components/settings/settingsSearch.test.ts src/pages/admin-settings/AdminSettingsLayout.test.tsx src/pages/SettingsLayout.test.tsxpnpm --dir web exec tsc -b --pretty falsepnpm --dir web run lint(0 errors; existing warnings remain)git diff --cached --checkAI Use
Implemented with Codex.
Summary by CodeRabbit
New Features
Tests