-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: Work Items state in the search result #8454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: preview
Are you sure you want to change the base?
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughBackend now emits issue "state_id" in search results; frontend displays a read-only StateDropdown next to each issue in the search modal; shared types add Changes
sequenceDiagram
autonumber
participant User
participant UI as Frontend (Search Modal)
participant API as Backend Search Endpoint
participant DB as Database
User->>UI: Trigger global search (query)
UI->>API: GET /search?query=...
API->>DB: Query issues (include state_id)
DB-->>API: Return issue rows (include state_id)
API-->>UI: JSON results (includes state_id)
UI->>UI: Render IssueIdentifier + read-only StateDropdown
UI-->>User: Display results with visible state
note right of API `#DFF0D8`: New: `state_id` included in payload
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (4)**/*.{ts,tsx,mts,cts}📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{js,jsx,ts,tsx,json,css}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (4)📚 Learning: 2025-06-18T09:46:08.566ZApplied to files:
📚 Learning: 2025-06-16T07:23:39.497ZApplied to files:
📚 Learning: 2025-07-08T13:41:01.659ZApplied to files:
📚 Learning: 2025-07-23T18:18:06.875ZApplied to files:
🧬 Code graph analysis (1)apps/web/core/components/power-k/ui/modal/search-results-map.tsx (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). (1)
🔇 Additional comments (1)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
apps/web/core/components/power-k/ui/modal/search-results-map.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/api/plane/app/views/search/base.py (1)
109-109: Prefer explicit "state_id" for consistency with SearchEndpoint.For consistency with line 411 in
SearchEndpointand clarity, use"state_id"instead of"state". While both return the state ID in Django's.values(), explicit"state_id"makes the intent clearer and maintains consistency across the codebase.🔎 Proposed fix
- "state" + "state_id"
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/api/plane/app/views/search/base.pyapps/web/core/components/power-k/ui/modal/search-results-map.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,mts,cts}
📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
**/*.{ts,tsx,mts,cts}: Useconsttype parameters for more precise literal inference in TypeScript 5.0+
Use thesatisfiesoperator to validate types without widening them
Leverage inferred type predicates to reduce the need for explicitisreturn types in filter/check functions
UseNoInfer<T>utility to block inference for specific type arguments when they should be determined by other arguments
Utilize narrowing inswitch(true)blocks for control flow analysis (TypeScript 5.3+)
Rely on narrowing from direct boolean comparisons for type guards
Trust preserved narrowing in closures when variables aren't modified after the check (TypeScript 5.4+)
Use constant indices to narrow object/array properties (TypeScript 5.5+)
Use standard ECMAScript decorators (Stage 3) instead of legacyexperimentalDecorators
Useusingdeclarations for explicit resource management with Disposable pattern instead of manual cleanup (TypeScript 5.2+)
Usewith { type: "json" }for import attributes; avoid deprecatedassertsyntax (TypeScript 5.3/5.8+)
Useimport typeexplicitly when importing types to ensure they are erased during compilation, respectingverbatimModuleSyntaxflag
Use.ts,.mts,.ctsextensions inimport typestatements (TypeScript 5.2+)
Useimport type { Type } from "mod" with { "resolution-mode": "import" }for specific module resolution contexts (TypeScript 5.3+)
Use new iterator methods (map, filter, etc.) if targeting modern environments (TypeScript 5.6+)
Utilize newSetmethods likeunion,intersection, etc., when available (TypeScript 5.5+)
UseObject.groupBy/Map.groupBystandard methods for grouping instead of external libraries (TypeScript 5.4+)
UsePromise.withResolvers()for creating promises with exposed resolve/reject functions (TypeScript 5.7+)
Use copying array methods (toSorted,toSpliced,with) for immutable array operations (TypeScript 5.2+)
Avoid accessing instance fields viasuperin classes (TypeScript 5....
Files:
apps/web/core/components/power-k/ui/modal/search-results-map.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Enable TypeScript strict mode and ensure all files are fully typed
Files:
apps/web/core/components/power-k/ui/modal/search-results-map.tsx
**/*.{js,jsx,ts,tsx,json,css}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier with Tailwind plugin for code formatting, run
pnpm fix:format
Files:
apps/web/core/components/power-k/ui/modal/search-results-map.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{js,jsx,ts,tsx}: Use ESLint with shared config across packages, adhering to max warnings limits per package
Use camelCase for variable and function names, PascalCase for components and types
Use try-catch with proper error types and log errors appropriately
Files:
apps/web/core/components/power-k/ui/modal/search-results-map.tsx
🧠 Learnings (2)
📚 Learning: 2025-10-29T09:17:54.815Z
Learnt from: NarayanBavisetti
Repo: makeplane/plane PR: 7905
File: apps/api/plane/app/views/search/base.py:241-276
Timestamp: 2025-10-29T09:17:54.815Z
Learning: In apps/api/plane/app/views/search/base.py, the `filter_intakes` method uses `Issue.objects` (base manager) instead of `Issue.issue_objects` (custom manager) because the custom manager filters out all intake statuses, which would prevent querying pending and snoozed intake issues.
Applied to files:
apps/api/plane/app/views/search/base.py
📚 Learning: 2025-12-23T14:18:32.899Z
Learnt from: dheeru0198
Repo: makeplane/plane PR: 8339
File: apps/api/plane/db/models/api.py:35-35
Timestamp: 2025-12-23T14:18:32.899Z
Learning: Django REST Framework rate limit strings are flexible: only the first character of the time unit matters. Acceptable formats include: "60/s", "60/sec", "60/second" (all equivalent), "60/m", "60/min", "60/minute" (all equivalent), "60/h", "60/hr", "60/hour" (all equivalent), and "60/d", "60/day" (all equivalent). Abbreviations like "min" are valid and do not need to be changed to "minute". Apply this guidance to any Python files in the project that configure DRF throttling rules.
Applied to files:
apps/api/plane/app/views/search/base.py
🧬 Code graph analysis (1)
apps/web/core/components/power-k/ui/modal/search-results-map.tsx (1)
apps/web/core/components/dropdowns/state/dropdown.tsx (1)
StateDropdown(17-46)
⏰ 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). (1)
- GitHub Check: Cursor Bugbot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/web/core/components/power-k/ui/modal/search-results-map.tsx (1)
48-53: Inconsistent defensive coding pattern.The StateDropdown component receives
projectId={workItem?.project_id?.toString() ?? ""}with optional chaining and type coercion (line 50), while the IssueIdentifier above (line 42) receivesprojectId={workItem.project_id}without any defensive checks.Since
project_idis typed as a requiredstringin theIWorkspaceIssueSearchResultinterface, the.toString()call is redundant. However, if you want defensive coding for edge cases, apply it consistently to both components.📋 Option 1: Remove unnecessary defensive coding (preferred if type guarantees hold)
<StateDropdown value={workItem?.state_id} - projectId={workItem?.project_id?.toString() ?? ""} + projectId={workItem.project_id} disabled={true} buttonVariant="background-with-text" />📋 Option 2: Apply defensive coding consistently to both components
<IssueIdentifier - projectId={workItem.project_id} + projectId={workItem?.project_id ?? ""} issueTypeId={workItem.type_id} projectIdentifier={workItem.project__identifier} issueSequenceId={workItem.sequence_id} size="xs" /> <StateDropdown value={workItem?.state_id} - projectId={workItem?.project_id?.toString() ?? ""} + projectId={workItem?.project_id ?? ""} disabled={true} buttonVariant="background-with-text" />
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/api/plane/app/views/search/base.pyapps/web/core/components/power-k/ui/modal/search-results-map.tsxpackages/types/src/workspace.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,mts,cts}
📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
**/*.{ts,tsx,mts,cts}: Useconsttype parameters for more precise literal inference in TypeScript 5.0+
Use thesatisfiesoperator to validate types without widening them
Leverage inferred type predicates to reduce the need for explicitisreturn types in filter/check functions
UseNoInfer<T>utility to block inference for specific type arguments when they should be determined by other arguments
Utilize narrowing inswitch(true)blocks for control flow analysis (TypeScript 5.3+)
Rely on narrowing from direct boolean comparisons for type guards
Trust preserved narrowing in closures when variables aren't modified after the check (TypeScript 5.4+)
Use constant indices to narrow object/array properties (TypeScript 5.5+)
Use standard ECMAScript decorators (Stage 3) instead of legacyexperimentalDecorators
Useusingdeclarations for explicit resource management with Disposable pattern instead of manual cleanup (TypeScript 5.2+)
Usewith { type: "json" }for import attributes; avoid deprecatedassertsyntax (TypeScript 5.3/5.8+)
Useimport typeexplicitly when importing types to ensure they are erased during compilation, respectingverbatimModuleSyntaxflag
Use.ts,.mts,.ctsextensions inimport typestatements (TypeScript 5.2+)
Useimport type { Type } from "mod" with { "resolution-mode": "import" }for specific module resolution contexts (TypeScript 5.3+)
Use new iterator methods (map, filter, etc.) if targeting modern environments (TypeScript 5.6+)
Utilize newSetmethods likeunion,intersection, etc., when available (TypeScript 5.5+)
UseObject.groupBy/Map.groupBystandard methods for grouping instead of external libraries (TypeScript 5.4+)
UsePromise.withResolvers()for creating promises with exposed resolve/reject functions (TypeScript 5.7+)
Use copying array methods (toSorted,toSpliced,with) for immutable array operations (TypeScript 5.2+)
Avoid accessing instance fields viasuperin classes (TypeScript 5....
Files:
packages/types/src/workspace.tsapps/web/core/components/power-k/ui/modal/search-results-map.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Enable TypeScript strict mode and ensure all files are fully typed
Files:
packages/types/src/workspace.tsapps/web/core/components/power-k/ui/modal/search-results-map.tsx
**/*.{js,jsx,ts,tsx,json,css}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier with Tailwind plugin for code formatting, run
pnpm fix:format
Files:
packages/types/src/workspace.tsapps/web/core/components/power-k/ui/modal/search-results-map.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{js,jsx,ts,tsx}: Use ESLint with shared config across packages, adhering to max warnings limits per package
Use camelCase for variable and function names, PascalCase for components and types
Use try-catch with proper error types and log errors appropriately
Files:
packages/types/src/workspace.tsapps/web/core/components/power-k/ui/modal/search-results-map.tsx
🧠 Learnings (6)
📚 Learning: 2025-06-18T09:46:08.566Z
Learnt from: prateekshourya29
Repo: makeplane/plane PR: 7188
File: web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(list)/header.tsx:40-45
Timestamp: 2025-06-18T09:46:08.566Z
Learning: When reviewing breadcrumb components that accept projectId or similar props, check if empty strings are being passed during loading states, which can result in invalid URLs. The preferred approach is to handle these loading states internally within the component rather than requiring each consumer to manage the loading logic.
Applied to files:
apps/web/core/components/power-k/ui/modal/search-results-map.tsx
📚 Learning: 2025-06-16T07:23:39.497Z
Learnt from: vamsikrishnamathala
Repo: makeplane/plane PR: 7214
File: web/core/store/issue/helpers/base-issues.store.ts:117-117
Timestamp: 2025-06-16T07:23:39.497Z
Learning: In the updateIssueDates method of BaseIssuesStore (web/core/store/issue/helpers/base-issues.store.ts), the projectId parameter is intentionally made optional to support override implementations in subclasses. The base implementation requires projectId and includes an early return check, but making it optional allows derived classes to override the method with different parameter requirements.
Applied to files:
apps/web/core/components/power-k/ui/modal/search-results-map.tsx
📚 Learning: 2025-07-08T13:41:01.659Z
Learnt from: prateekshourya29
Repo: makeplane/plane PR: 7363
File: apps/web/core/components/issues/select/dropdown.tsx:9-11
Timestamp: 2025-07-08T13:41:01.659Z
Learning: The `getProjectLabelIds` function in the label store handles undefined projectId internally, so it's safe to pass undefined values to it without explicit checks in the calling component.
Applied to files:
apps/web/core/components/power-k/ui/modal/search-results-map.tsx
📚 Learning: 2025-07-23T18:18:06.875Z
Learnt from: NarayanBavisetti
Repo: makeplane/plane PR: 7460
File: apps/api/plane/app/serializers/draft.py:112-122
Timestamp: 2025-07-23T18:18:06.875Z
Learning: In the Plane codebase serializers, workspace_id is not consistently passed in serializer context, so parent issue validation in DraftIssueCreateSerializer only checks project_id rather than both workspace_id and project_id. The existing project member authentication system already validates that users can only access projects they belong to, providing sufficient security without risking breaking functionality by adding workspace_id validation where the context might not be available.
Applied to files:
apps/web/core/components/power-k/ui/modal/search-results-map.tsx
📚 Learning: 2025-10-29T09:17:54.815Z
Learnt from: NarayanBavisetti
Repo: makeplane/plane PR: 7905
File: apps/api/plane/app/views/search/base.py:241-276
Timestamp: 2025-10-29T09:17:54.815Z
Learning: In apps/api/plane/app/views/search/base.py, the `filter_intakes` method uses `Issue.objects` (base manager) instead of `Issue.issue_objects` (custom manager) because the custom manager filters out all intake statuses, which would prevent querying pending and snoozed intake issues.
Applied to files:
apps/api/plane/app/views/search/base.py
📚 Learning: 2025-12-23T14:18:32.899Z
Learnt from: dheeru0198
Repo: makeplane/plane PR: 8339
File: apps/api/plane/db/models/api.py:35-35
Timestamp: 2025-12-23T14:18:32.899Z
Learning: Django REST Framework rate limit strings are flexible: only the first character of the time unit matters. Acceptable formats include: "60/s", "60/sec", "60/second" (all equivalent), "60/m", "60/min", "60/minute" (all equivalent), "60/h", "60/hr", "60/hour" (all equivalent), and "60/d", "60/day" (all equivalent). Abbreviations like "min" are valid and do not need to be changed to "minute". Apply this guidance to any Python files in the project that configure DRF throttling rules.
Applied to files:
apps/api/plane/app/views/search/base.py
🧬 Code graph analysis (1)
apps/web/core/components/power-k/ui/modal/search-results-map.tsx (1)
apps/web/core/components/dropdowns/state/dropdown.tsx (1)
StateDropdown(17-46)
⏰ 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). (1)
- GitHub Check: Cursor Bugbot
🔇 Additional comments (3)
packages/types/src/workspace.ts (1)
132-132: LGTM! Clean type addition.The
state_idfield is correctly added to the interface using snake_case naming convention, consistent with all other fields inIWorkspaceIssueSearchResult.apps/web/core/components/power-k/ui/modal/search-results-map.tsx (1)
17-17: LGTM! State display successfully integrated into search results.The StateDropdown component is correctly imported and integrated into the issue search results with appropriate props:
value={workItem?.state_id}correctly uses the new fielddisabled={true}makes it read-only, appropriate for search resultsbuttonVariant="background-with-text"provides visual stylingThe component is well-positioned between the issue identifier and the issue name, providing clear state visibility in search results as intended by the PR objectives.
Also applies to: 48-53
apps/api/plane/app/views/search/base.py (1)
109-109: Add missingtype_idto bothfilter_issuesandfilter_intakes.Both methods are missing required fields expected by the frontend. The
IWorkspaceIssueSearchResultTypeScript interface specifies that search results should includetype_idandstate_id.
filter_issues(lines 102-110): Add"type_id"to the.values()callfilter_intakes(lines 254-264): Add both"type_id"and"state_id"to the.values()callThe Issue model supports both fields via ForeignKey relationships, matching what
SearchEndpointalready returns.⛔ Skipped due to learnings
Learnt from: NarayanBavisetti Repo: makeplane/plane PR: 7905 File: apps/api/plane/app/views/search/base.py:241-276 Timestamp: 2025-10-29T09:17:54.815Z Learning: In apps/api/plane/app/views/search/base.py, the `filter_intakes` method uses `Issue.objects` (base manager) instead of `Issue.issue_objects` (custom manager) because the custom manager filters out all intake statuses, which would prevent querying pending and snoozed intake issues.Learnt from: NarayanBavisetti Repo: makeplane/plane PR: 7460 File: apps/api/plane/app/serializers/draft.py:112-122 Timestamp: 2025-07-23T18:18:06.875Z Learning: In the Plane codebase serializers, workspace_id is not consistently passed in serializer context, so parent issue validation in DraftIssueCreateSerializer only checks project_id rather than both workspace_id and project_id. The existing project member authentication system already validates that users can only access projects they belong to, providing sufficient security without risking breaking functionality by adding workspace_id validation where the context might not be available.
| projectId={workItem?.project_id?.toString() ?? ""} | ||
| disabled={true} | ||
| buttonVariant="background-with-text" | ||
| /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabled StateDropdown won't fetch missing project states
The StateDropdown component only fetches states when opened via onDropdownOpen, but since disabled={true} is set, the dropdown will never be opened. For workspace search results that include issues from multiple projects, if a project's states haven't been loaded into the store yet, the state will display fallback content (backlog icon and "State" text) instead of the actual state name and color. The codebase has a ReadonlyState component specifically designed for this read-only use case that fetches states on mount via useEffect.
Description
Implemented work item status to display in the search result
Fixes #7722
Fixes #8144
Type of Change
Screenshots and Media (if applicable)
Workspace search

Command+k

Test Scenarios
References
Note
Shows work item state alongside identifiers in search results.
state_idinissueresults (apps/api/.../search/base.py)state_idtoIWorkspaceIssueSearchResult(packages/types/src/workspace.ts)StateDropdownnext toIssueIdentifierin Power K search results (apps/web/.../search-results-map.tsx)Written by Cursor Bugbot for commit a00ddcc. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.