Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis change refactors how label data is handled throughout the mail application. The Changes
Sequence Diagram(s)sequenceDiagram
participant UI_Component
participant useLabels_Hook
participant Data_Source
UI_Component->>useLabels_Hook: Call useLabels()
useLabels_Hook->>Data_Source: Fetch all labels
Data_Source-->>useLabels_Hook: Return labels[]
useLabels_Hook-->>UI_Component: Return { userLabels, systemLabels, ... }
UI_Component->>UI_Component: Use userLabels/systemLabels as needed
Possibly related PRs
Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (13)
✨ Finishing Touches
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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Actionable comments posted: 4
🔭 Outside diff range comments (1)
apps/mail/components/mail/mail.tsx (1)
1017-1221: Remove dead code from CategorySelect component.The CategorySelect component has large sections of commented-out code (lines 1037-1087, 1132-1137, 1183-1199) making it essentially non-functional. Since CategoryDropdown appears to replace this functionality, consider:
- Remove the component entirely if it's no longer needed
- If still needed, remove the commented code and properly refactor
- The component still returns UI but with disabled functionality
Either remove the entire component or clean up the dead code. If keeping the component, remove lines 1033-1087, 1132-1137, and 1183-1199.
🧹 Nitpick comments (2)
apps/mail/hooks/use-threads.ts (1)
76-76: Fix comment mismatch.The comment says "1 minute" but the actual value
1000 * 60 * 60equals 1 hour.- staleTime: 1000 * 60 * 60, // 1 minute + staleTime: 1000 * 60 * 60, // 1 hourapps/mail/hooks/use-labels.ts (1)
12-22: Consider optimizing the label categorization with a single pass.The current implementation filters the array twice. Consider using a single reduce operation for better performance with large label sets:
const { userLabels, systemLabels } = useMemo(() => { if (!labelQuery.data) return { userLabels: [], systemLabels: [] }; - return { - userLabels: labelQuery.data.filter((label) => label.type === 'user'), - systemLabels: labelQuery.data.filter((label) => label.type === 'system'), - }; + return labelQuery.data.reduce( + (acc, label) => { + if (label.type === 'user') { + acc.userLabels.push(label); + } else if (label.type === 'system') { + acc.systemLabels.push(label); + } + return acc; + }, + { userLabels: [], systemLabels: [] } + ); }, [labelQuery.data]);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
apps/mail/app/(routes)/mail/[folder]/page.tsx(1 hunks)apps/mail/app/(routes)/settings/labels/page.tsx(5 hunks)apps/mail/app/routes.ts(1 hunks)apps/mail/components/context/command-palette-context.tsx(1 hunks)apps/mail/components/context/thread-context.tsx(6 hunks)apps/mail/components/mail/mail.tsx(12 hunks)apps/mail/components/ui/nav-main.tsx(2 hunks)apps/mail/components/ui/sidebar-labels.tsx(1 hunks)apps/mail/config/navigation.ts(1 hunks)apps/mail/hooks/use-labels.ts(1 hunks)apps/mail/hooks/use-stats.ts(0 hunks)apps/mail/hooks/use-threads.ts(2 hunks)apps/server/src/routes/chat.ts(1 hunks)
💤 Files with no reviewable changes (1)
- apps/mail/hooks/use-stats.ts
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/app/routes.ts (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/config/navigation.ts (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/app/(routes)/mail/[folder]/page.tsx (2)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.376Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
apps/mail/components/context/command-palette-context.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/ui/nav-main.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/hooks/use-threads.ts (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.376Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
apps/mail/hooks/use-labels.ts (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/app/(routes)/settings/labels/page.tsx (3)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.376Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
Learnt from: danteissaias
PR: Mail-0/Zero#902
File: apps/mail/components/connection/add.tsx:77-77
Timestamp: 2025-05-07T16:55:46.513Z
Learning: For the "Upgrade" link in AddConnectionDialog, using a proper <button> element instead of a <span> with onClick is recognized as an accessibility improvement but was deferred as out of scope in PR #902 (CSS variables PR).
apps/mail/components/ui/sidebar-labels.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/context/thread-context.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/mail/mail.tsx (3)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: danteissaias
PR: Mail-0/Zero#902
File: apps/mail/components/connection/add.tsx:77-77
Timestamp: 2025-05-07T16:55:46.513Z
Learning: For the "Upgrade" link in AddConnectionDialog, using a proper <button> element instead of a <span> with onClick is recognized as an accessibility improvement but was deferred as out of scope in PR #902 (CSS variables PR).
Learnt from: Fahad-Dezloper
PR: Mail-0/Zero#1440
File: apps/mail/components/create/ai-chat.tsx:101-113
Timestamp: 2025-06-22T19:23:10.599Z
Learning: On small and medium screens (mobile devices), buttons don't naturally lose focus after being clicked like they do on desktop browsers. This requires manual intervention using setTimeout with additional blur() calls and DOM manipulation to properly clear focus and active states in button click handlers for responsive design.
🧬 Code Graph Analysis (6)
apps/mail/app/(routes)/mail/[folder]/page.tsx (1)
apps/mail/hooks/use-labels.ts (1)
useLabels(5-22)
apps/mail/components/context/command-palette-context.tsx (1)
apps/mail/hooks/use-labels.ts (1)
useLabels(5-22)
apps/mail/components/ui/nav-main.tsx (1)
apps/mail/hooks/use-labels.ts (1)
useLabels(5-22)
apps/mail/app/(routes)/settings/labels/page.tsx (1)
apps/mail/hooks/use-labels.ts (1)
useLabels(5-22)
apps/mail/components/ui/sidebar-labels.tsx (2)
apps/mail/hooks/use-stats.ts (1)
useStats(5-16)apps/mail/hooks/use-connections.ts (1)
useActiveConnection(10-22)
apps/mail/components/mail/mail.tsx (5)
apps/mail/components/ui/button.tsx (1)
Button(71-71)apps/mail/lib/utils.ts (1)
cn(51-51)apps/mail/hooks/use-labels.ts (1)
useLabels(5-22)apps/mail/components/icons/icons.tsx (3)
ChevronDown(1200-1216)Check(1632-1647)apps/mail/components/mail/use-mail.ts (1)
useMail(21-23)
🔇 Additional comments (15)
apps/mail/app/(routes)/mail/[folder]/page.tsx (1)
29-29: LGTM: Consistent with useLabels hook refactor.The change correctly updates the destructuring to use
userLabelsdirectly instead of aliasingdata, which aligns with the updateduseLabelshook that now returns separateuserLabelsandsystemLabelsarrays.apps/mail/components/context/command-palette-context.tsx (1)
200-200: LGTM: Correctly updated for new hook API.The destructuring change from
{ data: userLabels = [] }to{ userLabels = [] }is consistent with the updateduseLabelshook and maintains the appropriate default value.apps/mail/app/(routes)/settings/labels/page.tsx (1)
42-42: LGTM: Correctly updated for separated label types.The change from
{ data: labels, ... }to{ userLabels: labels, ... }aligns with the updateduseLabelshook that now returns separateuserLabelsandsystemLabelsarrays instead of a singledataarray.apps/server/src/routes/chat.ts (1)
671-676: Good architectural change to move label filtering to the client.This change appropriately delegates label categorization to the frontend, providing more flexibility for client-side filtering and reducing server-side logic. The client can now handle both user and system labels as needed.
apps/mail/components/ui/nav-main.tsx (2)
75-75: Correct usage of the updated useLabels hook.The destructuring now directly extracts
userLabelsinstead of aliasingdata, which aligns with the hook's new return structure and improves code clarity.
262-262: Clean simplification of SidebarLabels props.Good use of the nullish coalescing operator to provide a default empty array. The removal of
activeAccountandstatsprops aligns with the component's refactoring to fetch its own data internally.apps/mail/hooks/use-labels.ts (1)
25-25: Correct adaptation to the new useLabels structure.The destructuring properly extracts
userLabelsand maintains the existinglabelsvariable name for backward compatibility.apps/mail/components/ui/sidebar-labels.tsx (1)
2-4: Excellent refactoring to use hooks internally.Moving data fetching into the component using hooks reduces prop drilling and makes the component more self-contained. This follows React best practices for component design.
Also applies to: 12-14
apps/mail/components/context/thread-context.tsx (4)
61-61: Correct adaptation to useLabels hook structure.The destructuring properly extracts
userLabelsand aliases it tolabelsfor backward compatibility with the existing component logic.
146-153: Clean consolidation of hook destructuring.Consolidating all optimistic actions into a single destructuring statement improves code readability and reduces redundancy.
155-177: Excellent optimization of state derivation.Consolidating related state computations into a single
useMemohook reduces the number of memoization calls and improves performance. The logic is correctly preserved.
267-292: Great performance optimization with action memoization.Memoizing the action arrays prevents unnecessary re-creation on each render. The conversion of
getActionsfrom a function to a memoized array is appropriate since it doesn't require parameters. All dependencies are correctly specified.Also applies to: 311-411, 413-446
apps/mail/components/mail/mail.tsx (3)
25-30: LGTM! Import changes align with new dropdown functionality.The addition of dropdown menu components and the updated
useLabelshook import properly support the new CategoryDropdown implementation.Also applies to: 38-38, 46-46, 67-67
122-132: Good improvements to label data management.The addition of
staleTimereduces unnecessary API calls, and theonSuccesscallback ensures labels are refreshed after updates, improving data consistency.
501-501: UI adjustments look good.The minor height and positioning adjustments improve visual consistency.
Also applies to: 551-551, 568-569, 587-587
| route('/general', '(routes)/settings/general/page.tsx'), | ||
| route('/labels', '(routes)/settings/labels/page.tsx'), | ||
| route('/categories', '(routes)/settings/categories/page.tsx'), | ||
| // route('/categories', '(routes)/settings/categories/page.tsx'), |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Consider replacing commented-out route with a feature flag or disabled meta instead of leaving dead code
Commenting out the /categories route works short-term but silently grows dead code and makes future re-enablement harder to track. Prefer a feature-flag guard (e.g., enabled: false) or a // TODO(date): note so tooling can pick it up and avoid accidental rot.
Please confirm there are no deep links or tests still hitting /settings/categories. If unsure, run:
🏁 Script executed:
#!/bin/bash
# Find any references to the removed categories route
rg -n "/settings/categories"Length of output: 376
Introduce a feature‐flag or disabled meta for the /settings/categories route
Rather than leaving both the route and its navigation entry commented out, encode the intent directly so future tooling and maintainers can detect and re‐enable it safely. For example:
• In apps/mail/app/routes.ts (around line 45):
- // route('/categories', '(routes)/settings/categories/page.tsx'),
+ route('/categories', '(routes)/settings/categories/page.tsx', { disabled: true }),• In apps/mail/config/navigation.ts (around line 174):
- // url: '/settings/categories',
+ {
+ url: '/settings/categories',
+ label: t('navigation/settings/categories'),
+ disabled: true,
+ },This makes it explicit that the feature exists but is currently inactive, and can be surfaced by linters or custom scripts.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In apps/mail/app/routes.ts at line 45, replace the commented-out route for
'/categories' with a route definition that includes a feature flag or a disabled
meta property indicating the route is inactive. This explicit flag should
clearly mark the route as currently disabled but present, enabling future
tooling and maintainers to detect and safely re-enable it without relying on
commented code.
| // { | ||
| // title: m['navigation.settings.categories'](), | ||
| // url: '/settings/categories', | ||
| // icon: Tabs, | ||
| // }, |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Navigation item removal may desync hotkeys / i18n keys
The sidebar entry for “categories” is now commented out, but:
- Hotkey mappings (
mail-list-hotkeys.tsx) might still expect the item. - The i18n message key
navigation.settings.categoriesremains referenced and could become unused noise.
Double-check both to prevent orphaned code and translation bloat.
🏁 Script executed:
#!/bin/bash
# Verify hotkey usage and unused i18n key
rg -n "categories" apps/mail/lib/hotkeys | head
rg -n "navigation.settings.categories" --invert-match apps/mail/config/navigation.ts | headLength of output: 775
🏁 Script executed:
#!/bin/bash
# Find references to the i18n key outside the commented nav config
rg -n "navigation.settings.categories" -g '!apps/mail/config/navigation.ts'
# Find translation definition in JSON files
rg -n '"navigation.settings.categories"' -g '*.json'
# Fallback: check TS/JS translation modules
rg -n '"navigation.settings.categories"' -g '*.{ts,js}'Length of output: 354
🏁 Script executed:
#!/bin/bash
# Locate translation key in mail locale files (slash-based keys)
rg -n "\"navigation/settings/categories\"" -g "apps/mail/**/locales/*.json" || echo "No JSON definitions found"
# Fallback: search for dot-based key in all translation sources
rg -n "navigation.settings.categories" -g "apps/mail/**/*.{json,ts,js}" || echo "No dot-based keys found"Length of output: 455
🏁 Script executed:
#!/bin/bash
# Search for slash-based translation key in all JSON translation files across the repo
rg -n '"navigation/settings/categories"' -g '*.json' || echo "Translation key not found in JSON files"Length of output: 143
Remove dead translation key; hotkeys are unaffected
The sidebar entry for “Categories” has been commented out, but:
- mail-list-hotkeys.tsx derives its category list from the
Categories()API, not from the navigation config—hotkey mappings remain valid. - The translation key
navigation.settings.categories(slash-based key in i18n.lock at lines 333 & 866) is no longer used anywhere in code or locale JSON.
Please:
• Remove the commented-out nav entry in apps/mail/config/navigation.ts (lines 172–176).
• Delete navigation/settings/categories from your translation sources and regenerate the i18n lock to clear the unused key.
🤖 Prompt for AI Agents
In apps/mail/config/navigation.ts around lines 172 to 176, remove the entire
commented-out navigation entry for "Categories" as it is dead code.
Additionally, delete the translation key "navigation.settings.categories" from
all translation source files and regenerate the i18n lock file to remove this
unused key from the project.
| throw new Error('No driver available'); | ||
| } | ||
| return (await this.driver.getUserLabels()).filter((label) => label.type === 'user'); | ||
| return await this.driver.getUserLabels(); |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Method name is now misleading - consider renaming for clarity.
The method getUserLabels now returns all labels instead of filtering by type === 'user'. This creates a semantic mismatch between the method name and its behavior, which could confuse future maintainers.
Consider renaming the method to better reflect its current behavior:
- async getUserLabels() {
+ async getLabels() {Alternatively, if the method should remain focused on user labels, consider adding a comment explaining why all labels are returned and how filtering is handled elsewhere.
Verify that all consumers of this method have been updated to handle the new behavior:
🏁 Script executed:
#!/bin/bash
# Description: Find all usages of getUserLabels to verify they handle the new unfiltered response
# Expected: All callers should be updated to handle both user and system labels
# Search for getUserLabels method calls
ast-grep --pattern 'getUserLabels()'
# Search for getUserLabels in method calls and property access
rg -A 3 -B 3 "getUserLabels"Length of output: 15490
Action Required: Align getUserLabels Name with Its Behavior
The getUserLabels method now returns all labels (user, system, categories), but its name implies it only returns user‐defined labels. This semantic mismatch can confuse maintainers and lead to incorrect assumptions in callers.
Possible remediations:
- Rename the method (and update all its usages) to
getLabelsto accurately reflect its behavior. - Or keep
getUserLabelsbut add/update JSDoc and method description to state that it returns all labels, and require callers to filter bytype === 'user'if needed.
Files/locations that would need updates when renaming:
- apps/server/src/routes/chat.ts
- apps/server/src/routes/agent/tools.ts
- apps/server/src/routes/ai.ts
- apps/server/src/trpc/routes/label.ts
- apps/server/src/services/mcp-service/mcp.ts
- apps/server/src/pipelines.ts
- apps/mail/lib/prompts.ts
- apps/server/src/lib/prompts.ts
Example diff for the rename approach:
--- a/apps/server/src/routes/chat.ts
+++ b/apps/server/src/routes/chat.ts
@@ -672,7 +672,7 @@ export class ZeroAgent extends BaseAgent {
- async getUserLabels() {
+ async getLabels() {
if (!this.driver) {
throw new Error('No driver available');
}
@@ -678,7 +678,7 @@ export class ZeroAgent extends BaseAgent {
return await this.driver.getUserLabels();
}After renaming, update all callers (tools, TRPC routes, pipelines, prompts) to call getLabels().
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| return await this.driver.getUserLabels(); | |
| async getLabels() { | |
| if (!this.driver) { | |
| throw new Error('No driver available'); | |
| } | |
| return await this.driver.getUserLabels(); | |
| } |
🤖 Prompt for AI Agents
In apps/server/src/routes/chat.ts at line 675, the method getUserLabels returns
all labels, not just user-defined ones, causing a naming mismatch. To fix this,
rename the method from getUserLabels to getLabels across all its definitions and
usages in the listed files, including chat.ts, tools.ts, ai.ts, label.ts,
mcp.ts, pipelines.ts, and prompt files. Alternatively, if renaming is not
preferred, update the JSDoc and method description to clarify it returns all
labels and instruct callers to filter by type 'user' when needed.
|
bugbot run |

Refactor Labels API Usage and Optimize Component Performance
Description
This PR refactors how labels are accessed throughout the application by restructuring the
useLabelshook to returnuserLabelsandsystemLabelsseparately. It also adds performance optimizations by memoizing component calculations and action handlers in the thread context menu. Additionally, it introduces a new category dropdown component for better label filtering and temporarily disables the categories settings page.Type of Change
Areas Affected
Testing Done
Checklist
Additional Notes
The main changes include:
useLabelshook to separate user and system labelsSummary by CodeRabbit
New Features
Refactor
Chores
Style