Skip to content

[WEB-4634]chore: refactor for work items store#7538

Merged
sriramveeraghanta merged 2 commits intopreviewfrom
chore-work_item_store_refactor
Aug 6, 2025
Merged

[WEB-4634]chore: refactor for work items store#7538
sriramveeraghanta merged 2 commits intopreviewfrom
chore-work_item_store_refactor

Conversation

@vamsikrishnamathala
Copy link
Member

@vamsikrishnamathala vamsikrishnamathala commented Aug 4, 2025

Description

This update refactors the work items store thus, increasing reusability across various features.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • New Features

    • Added support for a new issue type: Team Project Work Items, including new filtering and store options.
    • Introduced a new empty state display for Team Project Work Items.
    • Enabled handling of Team Project Work Items in issue layout, actions, and drag-and-drop features.
  • Improvements

    • Updated various hooks and store logic to recognize and process Team Project Work Items.
    • Extended modal and utility support for the new issue type.
  • Other

    • Minor internal updates and type enhancements to support the new issue type.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Walkthrough

This change introduces a new issue store type, TEAM_PROJECT_WORK_ITEMS, across the application. It adds new types, classes, React components, and store logic to support this store type, updating hooks, store constructors, and utility types accordingly. No existing logic is removed; all changes are additive and modular.

Changes

Cohort / File(s) Change Summary
New Issue Store Type Enum and Type Extensions
packages/types/src/issues/issue.ts, packages/constants/src/issue/common.ts
Added TEAM_PROJECT_WORK_ITEMS to EIssuesStoreType enum and extended related type unions.
Store and Filter Implementations
apps/web/ce/store/issue/team-project/filter.store.ts, apps/web/ce/store/issue/team-project/issue.store.ts, apps/web/ce/store/issue/team-project/index.ts
Introduced new filter and issue store classes/types for team project work items, with index re-exports.
Store Root Integration
apps/web/core/store/issue/root.store.ts
Added new observable properties and initialization for teamProjectWorkItems and its filter in the root store and interface.
Hooks Support for New Store Type
apps/web/core/hooks/store/use-issues.ts, apps/web/core/hooks/use-issue-layout-store.ts, apps/web/core/hooks/use-issues-actions.tsx, apps/web/core/hooks/use-group-dragndrop.ts
Updated hooks to support the new store type, including switch cases, type unions, and store selection logic.
Component Integration and Empty State
apps/web/core/components/issues/issue-layouts/empty-states/index.tsx, apps/web/ce/components/issues/issue-layouts/empty-states/team-project.tsx
Added new empty state React component and integrated it into the empty state switch logic.
Issue Actions Helper
apps/web/ce/helpers/issue-action-helper.ts
Added a new hook for actions related to team project work items.
Utility Type Update
packages/utils/src/work-item/base.ts
Extended handleIssueQueryParamsByLayout to accept "team_project_work_items" as a view type.
Whitespace Cleanup
apps/web/ce/components/issues/issue-layouts/empty-states/index.ts
Removed a trailing newline; no functional changes.

Sequence Diagram(s)

sequenceDiagram
    participant UI as UI Component
    participant RootStore as IssueRootStore
    participant TeamProjectStore as TeamProjectWorkItems
    participant Filter as TeamProjectWorkItemsFilter
    participant Hook as useIssues

    UI->>Hook: useIssues(EIssuesStoreType.TEAM_PROJECT_WORK_ITEMS)
    Hook->>RootStore: Access teamProjectWorkItems, teamProjectWorkItemsFilter
    RootStore->>TeamProjectStore: teamProjectWorkItems instance
    RootStore->>Filter: teamProjectWorkItemsFilter instance
    Hook-->>UI: Return { issues: teamProjectWorkItems, issuesFilter: teamProjectWorkItemsFilter }
    UI->>UI: Render TeamProjectWorkItemEmptyState if empty
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Suggested labels

🧹chore, ready_to_merge

Suggested reviewers

  • prateekshourya29
  • sriramveeraghanta

Poem

In the warren of code, a new path appears,
For team project work items, let’s give three cheers!
New stores and hooks, all tidy and neat,
With empty states ready, this change is complete.
🐇✨ The burrow grows deeper, the garden more bright—
Reviewers, hop in, and check if it’s right!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f6e20b2 and ebeebab.

📒 Files selected for processing (1)
  • apps/web/core/hooks/use-issue-layout-store.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/core/hooks/use-issue-layout-store.ts
⏰ 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). (3)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore-work_item_store_refactor

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vamsikrishnamathala vamsikrishnamathala changed the title chore: refactor for work items store [WEB-4634]chore: refactor for work items store Aug 4, 2025
@vamsikrishnamathala vamsikrishnamathala marked this pull request as ready for review August 4, 2025 15:20
@makeplane
Copy link

makeplane bot commented Aug 4, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🔭 Outside diff range comments (1)
apps/web/core/hooks/use-issue-layout-store.ts (1)

30-34: Fix the conditional logic order.

The current order of conditions has a critical issue: the check for teamspaceId on Line 30 will always return TEAM when teamspaceId is present, preventing the more specific conditions on Lines 32 and 34 from ever being reached.

Apply this diff to fix the condition ordering:

- if (teamspaceId) return EIssuesStoreType.TEAM;
-
- if (teamspaceId && viewId) return EIssuesStoreType.TEAM_VIEW;
-
- if (teamspaceId && projectId) return EIssuesStoreType.TEAM_PROJECT_WORK_ITEMS;
+ if (teamspaceId && viewId) return EIssuesStoreType.TEAM_VIEW;
+
+ if (teamspaceId && projectId) return EIssuesStoreType.TEAM_PROJECT_WORK_ITEMS;
+
+ if (teamspaceId) return EIssuesStoreType.TEAM;

More specific conditions (with multiple parameters) should be checked before general ones (with single parameters) to ensure the correct store type is returned.

🧹 Nitpick comments (1)
apps/web/ce/components/issues/issue-layouts/empty-states/team-project.tsx (1)

3-3: Consider implementing the empty state UI or adding a TODO comment.

The component currently renders an empty fragment, which provides no user feedback. Consider either:

  1. Implementing the actual empty state UI with appropriate messaging and styling
  2. Adding a TODO comment to indicate this is a placeholder awaiting implementation

Also, the observer wrapper is currently unnecessary since no observable state is being accessed, though it's harmless and shows intent for future development.

-export const TeamProjectWorkItemEmptyState: React.FC = observer(() => <></>);
+// TODO: Implement team project work items empty state UI
+export const TeamProjectWorkItemEmptyState: React.FC = observer(() => <></>);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dffe3a8 and f6e20b2.

📒 Files selected for processing (15)
  • apps/web/ce/components/issues/issue-layouts/empty-states/index.ts (1 hunks)
  • apps/web/ce/components/issues/issue-layouts/empty-states/team-project.tsx (1 hunks)
  • apps/web/ce/helpers/issue-action-helper.ts (1 hunks)
  • apps/web/ce/store/issue/team-project/filter.store.ts (1 hunks)
  • apps/web/ce/store/issue/team-project/index.ts (1 hunks)
  • apps/web/ce/store/issue/team-project/issue.store.ts (1 hunks)
  • apps/web/core/components/issues/issue-layouts/empty-states/index.tsx (2 hunks)
  • apps/web/core/hooks/store/use-issues.ts (3 hunks)
  • apps/web/core/hooks/use-group-dragndrop.ts (1 hunks)
  • apps/web/core/hooks/use-issue-layout-store.ts (1 hunks)
  • apps/web/core/hooks/use-issues-actions.tsx (3 hunks)
  • apps/web/core/store/issue/root.store.ts (4 hunks)
  • packages/constants/src/issue/common.ts (1 hunks)
  • packages/types/src/issues/issue.ts (1 hunks)
  • packages/utils/src/work-item/base.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: vamsikrishnamathala
PR: makeplane/plane#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.
📚 Learning: in the updateissuedates method of baseissuesstore (web/core/store/issue/helpers/base-issues.store.ts...
Learnt from: vamsikrishnamathala
PR: makeplane/plane#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/hooks/use-issue-layout-store.ts
  • apps/web/ce/store/issue/team-project/issue.store.ts
  • apps/web/ce/helpers/issue-action-helper.ts
  • apps/web/core/store/issue/root.store.ts
  • packages/types/src/issues/issue.ts
  • packages/constants/src/issue/common.ts
  • apps/web/core/hooks/use-group-dragndrop.ts
  • apps/web/ce/store/issue/team-project/index.ts
  • apps/web/core/hooks/store/use-issues.ts
  • apps/web/ce/store/issue/team-project/filter.store.ts
  • apps/web/core/components/issues/issue-layouts/empty-states/index.tsx
  • apps/web/core/hooks/use-issues-actions.tsx
  • packages/utils/src/work-item/base.ts
📚 Learning: the `getprojectlabelids` function in the label store handles undefined projectid internally, so it's...
Learnt from: prateekshourya29
PR: makeplane/plane#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/hooks/use-issue-layout-store.ts
  • apps/web/core/components/issues/issue-layouts/empty-states/index.tsx
📚 Learning: when reviewing breadcrumb components that accept projectid or similar props, check if empty strings ...
Learnt from: prateekshourya29
PR: makeplane/plane#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/ce/components/issues/issue-layouts/empty-states/team-project.tsx
  • apps/web/core/components/issues/issue-layouts/empty-states/index.tsx
📚 Learning: in the plane project codebase, the path alias `@/plane-web` resolves to the `ce` directory, making i...
Learnt from: vamsikrishnamathala
PR: makeplane/plane#7061
File: web/core/components/workspace-notifications/root.tsx:18-18
Timestamp: 2025-05-14T13:16:23.323Z
Learning: In the Plane project codebase, the path alias `@/plane-web` resolves to the `ce` directory, making imports like `@/plane-web/hooks/use-notification-preview` correctly resolve to files in `web/ce/hooks/`.

Applied to files:

  • apps/web/core/components/issues/issue-layouts/empty-states/index.tsx
📚 Learning: in the plane codebase, `issue_display_filters_by_layout` and `issue_display_filters_by_page` are two...
Learnt from: mathalav55
PR: makeplane/plane#6452
File: web/helpers/issue.helper.ts:6-6
Timestamp: 2025-01-24T09:37:19.339Z
Learning: In the Plane codebase, `ISSUE_DISPLAY_FILTERS_BY_LAYOUT` and `ISSUE_DISPLAY_FILTERS_BY_PAGE` are two distinct constants serving different purposes - one for layout-level filters and another for page-level filters. They are not interchangeable and should coexist.

Applied to files:

  • packages/utils/src/work-item/base.ts
🧬 Code Graph Analysis (6)
apps/web/ce/store/issue/team-project/issue.store.ts (2)
apps/web/core/store/issue/root.store.ts (1)
  • IIssueRootStore (57-126)
apps/web/ce/store/issue/team-project/filter.store.ts (1)
  • ITeamProjectWorkItemsFilter (5-5)
apps/web/core/store/issue/root.store.ts (2)
apps/web/ce/store/issue/team-project/filter.store.ts (2)
  • ITeamProjectWorkItemsFilter (5-5)
  • TeamProjectWorkItemsFilter (8-12)
apps/web/ce/store/issue/team-project/issue.store.ts (2)
  • ITeamProjectWorkItems (6-6)
  • TeamProjectWorkItems (9-13)
apps/web/core/hooks/store/use-issues.ts (2)
apps/web/ce/store/issue/team-project/issue.store.ts (1)
  • ITeamProjectWorkItems (6-6)
apps/web/ce/store/issue/team-project/filter.store.ts (1)
  • ITeamProjectWorkItemsFilter (5-5)
apps/web/ce/store/issue/team-project/filter.store.ts (1)
apps/web/core/store/issue/root.store.ts (1)
  • IIssueRootStore (57-126)
apps/web/core/components/issues/issue-layouts/empty-states/index.tsx (1)
apps/web/ce/components/issues/issue-layouts/empty-states/team-project.tsx (1)
  • TeamProjectWorkItemEmptyState (3-3)
apps/web/core/hooks/use-issues-actions.tsx (1)
apps/web/ce/helpers/issue-action-helper.ts (1)
  • useTeamProjectWorkItemsActions (17-22)
⏰ 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: Build and lint web apps
🔇 Additional comments (17)
packages/types/src/issues/issue.ts (1)

36-36: LGTM! Well-structured enum addition.

The new TEAM_PROJECT_WORK_ITEMS enum member follows the established naming convention and is placed appropriately at the end of the enum to avoid breaking existing code.

apps/web/ce/store/issue/team-project/index.ts (1)

1-2: LGTM! Clean module re-export pattern.

This index file follows the established pattern for organizing related store modules and provides a clean interface for importing the team project work items functionality.

apps/web/core/hooks/use-group-dragndrop.ts (1)

23-23: LGTM! Proper type extension for drag-and-drop support.

The addition of EIssuesStoreType.TEAM_PROJECT_WORK_ITEMS to the DNDStoreType union correctly extends drag-and-drop functionality to support the new store type.

apps/web/core/components/issues/issue-layouts/empty-states/index.tsx (2)

4-4: LGTM!

The import of TeamProjectWorkItemEmptyState follows the established pattern and path structure used for other team-related empty states.


44-45: LGTM!

The switch case for TEAM_PROJECT_WORK_ITEMS is properly integrated and follows the same pattern as other store types. The component currently renders an empty fragment as a placeholder, which is appropriate for initial implementation.

packages/constants/src/issue/common.ts (1)

105-105: LGTM!

The addition of TEAM_PROJECT_WORK_ITEMS to the TCreateModalStoreTypes union is consistent with the broader introduction of this store type across the codebase and maintains type safety for create modal operations.

apps/web/ce/helpers/issue-action-helper.ts (1)

17-22: LGTM!

The useTeamProjectWorkItemsActions function maintains consistency with the existing pattern in this CE helper file. All methods properly return resolved promises with undefined, matching the stub implementation approach used for other team-related actions.

apps/web/core/hooks/use-issues-actions.tsx (3)

20-20: LGTM!

The import of useTeamProjectWorkItemsActions is properly added to the existing import statement from the CE helper module.


58-58: LGTM!

The initialization of teamProjectWorkItemsActions follows the established naming convention and pattern used for other action hooks.


84-85: LGTM!

The switch case for TEAM_PROJECT_WORK_ITEMS is properly integrated and returns the appropriate actions object, maintaining consistency with the existing switch statement structure.

apps/web/core/store/issue/root.store.ts (4)

18-22: LGTM! New imports follow established patterns.

The imports for the new team project work items types are consistent with the existing import structure in the file.


109-110: LGTM! Interface properties added consistently.

The new properties teamProjectWorkItemsFilter and teamProjectWorkItems follow the established naming convention and type structure used by other issue store pairs in the interface.


183-184: LGTM! Class properties declared consistently.

The class property declarations match the interface and follow the same pattern as other issue store properties.


277-278: LGTM! Store initialization follows established pattern.

The instantiation correctly creates the filter store first and then passes it to the issues store constructor, consistent with other store pairs like projectIssuesFilter/projectIssues.

apps/web/core/hooks/store/use-issues.ts (3)

9-9: LGTM! Import follows established pattern.

The import for the new team project work items types is consistent with other similar imports in the file.


80-83: LGTM! Type definition follows established pattern.

The new entry in TStoreIssues type correctly includes both issues and issuesFilter properties with the appropriate types, matching the pattern used by other store types.


155-159: LGTM! Switch case implementation is consistent.

The new case for TEAM_PROJECT_WORK_ITEMS correctly merges the default store with the appropriate team project work items stores from the context, following the exact pattern used by other store types.

@pushya22 pushya22 marked this pull request as draft August 5, 2025 17:24
@vamsikrishnamathala vamsikrishnamathala marked this pull request as ready for review August 6, 2025 08:26
const archivedIssueActions = useArchivedIssueActions();
const workspaceDraftIssueActions = useWorkspaceDraftIssueActions();
const teamProjectWorkItemsActions = useTeamProjectWorkItemsActions();

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can import a function from plane-web for additional properties for better abstraction

@gakshita
Copy link
Collaborator

gakshita commented Aug 6, 2025

We can avoid adding all the placeholder functions and stores and instead implement a issue store which can be extended

@prateekshourya29
Copy link
Member

We can avoid adding all the placeholder functions and stores and instead implement a issue store which can be extended

That’s the plan, but it would require quite a few changes at the moment. We can do it if we have sufficient bandwidth.

@sriramveeraghanta sriramveeraghanta merged commit 9de5b1a into preview Aug 6, 2025
5 of 7 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore-work_item_store_refactor branch August 6, 2025 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants