Conversation
📝 WalkthroughWalkthroughAdds React Query–backed persistence of “jargons” to config, integrates it into the SearchHeader replace-all flow, updates the Settings General view to a multiline Textarea with commit-on-enter behavior, and augments the system prompt template to instruct typo correction based on configured jargons. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant SH as SearchHeader (UI)
participant RQ as React Query (QueryClient)
participant DB as dbCommands (getConfig/setConfig)
Note over SH: On mount / render
SH->>RQ: useQuery(["config","general"], getConfig)
RQ->>DB: getConfig()
DB-->>RQ: config
RQ-->>SH: config
Note over U,SH: Replace All flow
U->>SH: Click "Replace All"
SH->>SH: replaceAll()
alt replaceTerm non-empty AND resultCount > 0
SH->>RQ: mutate(updateJargons(replaceTerm))
RQ->>DB: setConfig(updated config with jargon appended)
DB-->>RQ: success
RQ->>RQ: invalidateQueries(["config","general"])
RQ->>DB: refetch getConfig()
DB-->>RQ: config (updated)
RQ-->>SH: config (updated)
else
SH-->>U: No jargon update
end
sequenceDiagram
autonumber
participant U as User
participant SG as Settings > General (UI)
participant RQ as React Query (Mutation)
participant DB as dbCommands (setConfig)
U->>SG: Edit jargons Textarea
alt Blur OR Press Enter
SG->>RQ: mutate(jargonsText)
RQ->>DB: setConfig(jargons parsed from textarea)
DB-->>RQ: success
RQ->>RQ: invalidateQueries(["config","general"])
else
SG-->>U: Await commit
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (5)
apps/desktop/src/components/settings/views/general.tsx (3)
439-444: Let Enter add a newline; commit on Ctrl/Cmd+Enter to match a textarea’s UX.Current handler prevents newlines, defeating the purpose of a textarea.
Apply:
- onKeyDown={(e) => { - if (e.key === "Enter") { - e.preventDefault(); - mutation.mutate(form.getValues()); - e.currentTarget.blur(); - } - }} + onKeyDown={(e) => { + if ((e.ctrlKey || e.metaKey) && e.key === "Enter") { + e.preventDefault(); + mutation.mutate(form.getValues()); + } + }}
446-448: Clarify placeholder to reflect multi-line support.Apply:
- placeholder={t({ - id: "Type terms separated by commas (e.g., Blitz Meeting, PaC Squad)", - })} + placeholder={t({ + id: "Type terms separated by commas or new lines (e.g., Blitz Meeting, PaC Squad)", + })}
434-449: Normalize parsing and dedupe when saving jargons.Users will paste line-separated terms. Split on commas or newlines and de-duplicate before persisting.
In the mutation where
nextGeneralis built (around Line 140), update:// current jargons: v.jargons.split(",").map((j) => j.trim()).filter(Boolean), // suggested const parsed = v.jargons .split(/[,\n]/g) .map((j) => j.trim()) .filter(Boolean); jargons: Array.from(new Set(parsed)),apps/desktop/src/components/right-panel/components/search-header.tsx (2)
29-55: Avoid case-variant duplicates and needless invalidations.
- Use case-insensitive check to prevent duplicates like “PaC Squad” vs “pac squad”.
- Only invalidate when a write actually occurred.
Apply:
- const updateJargonsMutation = useMutation({ - mutationFn: async (newJargon: string) => { + const updateJargonsMutation = useMutation({ + mutationFn: async (newJargon: string) => { if (!config.data) { - return; + return false; } const currentJargons = config.data.general.jargons || []; const trimmedJargon = newJargon.trim(); - if (!trimmedJargon || currentJargons.includes(trimmedJargon)) { - return; + const exists = currentJargons.some( + (j) => j.localeCompare(trimmedJargon, undefined, { sensitivity: "accent" }) === 0, + ); + if (!trimmedJargon || exists) { + return false; } const updatedJargons = [...currentJargons, trimmedJargon]; await dbCommands.setConfig({ ...config.data, general: { ...config.data.general, jargons: updatedJargons, }, }); - }, - onSuccess: () => { - queryClient.invalidateQueries({ queryKey: ["config", "general"] }); - }, + return true; + }, + onSuccess: (updated) => { + if (updated) { + queryClient.invalidateQueries({ queryKey: ["config", "general"] }); + } + }, });
151-155: Trigger jargon update with trimmed term.Minor: ensure trimming at callsite too; avoids storing accidental whitespace.
Apply:
- if (replaceTerm && replaceTerm.trim() && resultCount > 0) { - updateJargonsMutation.mutate(replaceTerm); + const trimmed = replaceTerm.trim(); + if (trimmed && resultCount > 0) { + updateJargonsMutation.mutate(trimmed); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (2)
apps/desktop/src/locales/en/messages.pois excluded by!**/*.poapps/desktop/src/locales/ko/messages.pois excluded by!**/*.po
📒 Files selected for processing (3)
apps/desktop/src/components/right-panel/components/search-header.tsx(3 hunks)apps/desktop/src/components/settings/views/general.tsx(4 hunks)crates/template/assets/enhance.system.jinja(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}
⚙️ CodeRabbit configuration file
**/*.{js,ts,tsx,rs}: 1. Do not add any error handling. Keep the existing one.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".
Files:
apps/desktop/src/components/right-panel/components/search-header.tsxapps/desktop/src/components/settings/views/general.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: ci (windows, windows-latest)
- GitHub Check: ci (macos, macos-14)
🔇 Additional comments (4)
apps/desktop/src/components/settings/views/general.tsx (2)
28-28: Import looks correct.
305-336: Hidden “Display language” UI still has schema/watchers. Verify intent.Field remains in the schema and watch side-effects (toast) still fire, but the control is commented out. Confirm this is intentional; otherwise, consider removing the field from schema/watch logic until re-enabled.
apps/desktop/src/components/right-panel/components/search-header.tsx (2)
1-4: Imports and React Query wiring look good.
19-27: Config query usage is appropriate.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
No description provided.