Skip to content

Comments

chore: issue filters refactor#6742

Merged
sriramveeraghanta merged 3 commits intopreviewfrom
chore-issue_filters_refactor
Mar 17, 2025
Merged

chore: issue filters refactor#6742
sriramveeraghanta merged 3 commits intopreviewfrom
chore-issue_filters_refactor

Conversation

@vamsikrishnamathala
Copy link
Member

@vamsikrishnamathala vamsikrishnamathala commented Mar 11, 2025

Description

This update includes a code refactoring for issue properties.

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

Summary by CodeRabbit

  • New Features

    • Introduced a unified component that consistently displays additional work item properties in issue sidebars and preview views.
    • Added a new function to enhance sorting capabilities for work items.
  • Refactor

    • Centralized the logic for rendering dynamic columns in spreadsheet views.
    • Enhanced the sorting mechanism for issues, improving the default ordering.
    • Adjusted the issue details layout to modify content overflow behavior for a more responsive display.
  • Bug Fixes

    • Updated prop naming for clarity in the WorkItemAdditionalSidebarProperties component across various instances.
  • Chores

    • Removed unused exports and components to streamline the codebase.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2025

Walkthrough

This pull request introduces several changes across the application. The property workItemType has been renamed to workItemTypeId in various components, including WorkItemAdditionalSidebarProperties, IssueDetailsSidebar, and PeekOverviewProperties. The shouldRenderColumn function in issue-filter.helper.ts has been simplified by changing its parameter structure. Additionally, a new function workItemSortWithOrderByExtended has been added to enhance sorting mechanisms. Minor layout adjustments and new re-export files in the EE folder are also included.

Changes

File(s) Change Summary
web/ce/components/issues/issue-details/additional-properties.tsx
web/core/components/issues/issue-detail/sidebar.tsx
web/core/components/issues/peek-overview/properties.tsx
web/ee/components/issues/issue-details/additional-properties.tsx
Renamed prop workItemType to workItemTypeId in WorkItemAdditionalSidebarProperties and updated corresponding usages; added re-export for EE usage.
web/ce/helpers/issue-filter.helper.ts Modified shouldRenderColumn function to accept a single parameter key instead of an object, simplifying the interface and deriving isEstimateEnabled from the store context.
web/ce/store/issue/helpers/base-issue.store.ts
web/core/store/issue/helpers/base-issues.store.ts
web/ee/store/issue/helpers/base-issue.store.ts
Added workItemSortWithOrderByExtended for enhanced sorting; updated issuesSortWithOrderBy to use the new function; provided re-export in the EE folder.
web/core/components/issues/issue-detail/root.tsx Removed the overflow-hidden class from a div element, altering overflow behavior without affecting other layout properties.
web/core/components/issues/issue-layouts/spreadsheet/issue-column.tsx
web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.tsx
Removed isEstimateEnabled from destructured props and updated calls to shouldRenderColumn to pass only the property argument.
web/ee/store/issue/helpers/base-issue.store.ts Introduced a new file that exports all entities from ce/store/issue/helpers/base-issue.store.

Possibly related PRs

  • chore: properties validation. #5718: The changes in the main PR, which involve the removal of the IssueAdditionalPropertyValuesUpdate component and its props, are related to the modifications in the retrieved PR that update the type definition for TIssueAdditionalPropertyValuesUpdateProps, as both pertain to the same component and its properties.
  • [WEB-3504]chore: issue properties refactor #6724: The changes in the main PR, which involve the removal of the WorkItemAdditionalSidebarProperties component's logic and its observer wrapper, are related to the modifications in the retrieved PR that introduce a new component WorkItemLayoutAdditionalProperties with similar props, indicating a shift in how additional properties are handled.

Suggested reviewers

  • prateekshourya29
  • sriramveeraghanta

Poem

Hop, skip, and code away,
A rabbit sings of changes today.
New props and functions lead the dance,
In every component, bugs stand no chance.
With a twitch of a nose and a cheerful cheer,
Our code hops ahead into a bright, new sphere!
🐇💻


📜 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 3023964 and 51c9e91.

📒 Files selected for processing (9)
  • web/ce/components/issues/issue-details/additional-properties.tsx (1 hunks)
  • web/ce/components/issues/issue-details/additional-properties.tsx (1 hunks)
  • web/ce/components/issue-types/index.ts (0 hunks)
  • web/ce/components/issue-types/values/index.ts (0 hunks)
  • web/ce/components/issue-types/values/update.tsx (0 hunks)
  • web/ce/components/issues/issue-details/additional-properties.tsx (1 hunks)
  • web/ee/components/issue-types/index.ts (0 hunks)
  • web/ee/components/issue-types/values/index.ts (0 hunks)
  • web/ee/components/issue-types/values/update.tsx (0 hunks)
💤 Files with no reviewable changes (6)
  • web/ee/components/issue-types/index.ts
  • web/ce/components/issue-types/values/update.tsx
  • web/ce/components/issue-types/values/index.ts
  • web/ce/components/issue-types/index.ts
  • web/ee/components/issue-types/values/update.tsx
  • web/ee/components/issue-types/values/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/ce/components/issues/issue-details/additional-properties.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
web/ce/components/issues/issue-details/additional-properties.tsx (1)

13-13:

Details

❓ Verification inconclusive

Confirm intended removal of component functionality.

This change returns an empty fragment, effectively removing all functionality from the WorkItemAdditionalSidebarProperties component. If this is intentional, please verify that no external references depend on the original logic or rendering. Otherwise, consider preserving or migrating the existing functionality.

You can run the following script to confirm that no references rely on the removed implementation:


🏁 Script executed:

#!/bin/bash
# Searching for references to WorkItemAdditionalSidebarProperties and IssueAdditionalPropertyValuesUpdate
rg "WorkItemAdditionalSidebarProperties" -A 5 -B 5
rg "IssueAdditionalPropertyValuesUpdate" -A 5 -B 5

Length of output: 5452


Action Required: Confirm and Update Dependent Usages

The WorkItemAdditionalSidebarProperties component now returns an empty fragment, effectively removing its original functionality. However, our search shows that this component is still imported and rendered in the following files:

  • web/core/components/issues/peek-overview/properties.tsx
  • web/core/components/issues/issue-detail/sidebar.tsx

Please verify that these references have been reviewed and updated if necessary. If removal of the component’s behavior is intentional, ensure that the consuming components no longer rely on the previous logic. Additionally, no references to IssueAdditionalPropertyValuesUpdate were found, which might indicate it isn’t in use.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @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 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.

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: 1

🧹 Nitpick comments (1)
web/ce/components/issues/issue-details/additional-properties.tsx (1)

16-31: Good component abstraction

This new component effectively encapsulates the rendering of issue additional properties. The conditional rendering based on workItemType is appropriate, and the props are properly passed down to the child component.

According to the PR summary, this component replaces direct usage of IssueAdditionalPropertyValuesUpdate in multiple locations, which improves code reusability and maintainability.

However, I noticed that the isPeekView prop is defined in the type but not used in the component. Consider using this prop or removing it if it's not needed.

-  const { workItemId, projectId, workItemType, workspaceSlug, isEditable } = props;
+  const { workItemId, projectId, workItemType, workspaceSlug, isEditable, isPeekView } = props;

Then pass it to the child component if needed.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a477f55 and 8aba3b1.

📒 Files selected for processing (11)
  • web/ce/components/issues/issue-details/additional-properties.tsx (1 hunks)
  • web/ce/helpers/issue-filter.helper.ts (1 hunks)
  • web/ce/store/issue/helpers/base-issue.store.ts (1 hunks)
  • web/core/components/issues/issue-detail/root.tsx (1 hunks)
  • web/core/components/issues/issue-detail/sidebar.tsx (2 hunks)
  • web/core/components/issues/issue-layouts/spreadsheet/issue-column.tsx (2 hunks)
  • web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.tsx (2 hunks)
  • web/core/components/issues/peek-overview/properties.tsx (2 hunks)
  • web/core/store/issue/helpers/base-issues.store.ts (2 hunks)
  • web/ee/components/issues/issue-details/additional-properties.tsx (1 hunks)
  • web/ee/store/issue/helpers/base-issue.store.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (16)
web/ee/store/issue/helpers/base-issue.store.ts (1)

1-1: Re-exporting module is a good practice for maintainability

This file re-exports all entities from the CE (Community Edition) module, which is a good pattern for maintaining separation between CE and EE (Enterprise Edition) code while allowing consumers to import from a consistent path.

web/ee/components/issues/issue-details/additional-properties.tsx (1)

1-1: Clean re-export follows established pattern

This file correctly re-exports all entities from the corresponding CE file, following the same pattern seen elsewhere in the codebase. This maintains a clean separation between CE and EE implementations.

web/core/components/issues/issue-detail/root.tsx (1)

374-374: Removed overflow-hidden from sidebar container

Removing the overflow-hidden class from this container will allow content to overflow, which might be intentional but could also lead to layout issues. Verify that this change doesn't cause unwanted scrollbars or content overlaps in different viewport sizes.

This change is likely related to the adoption of the new WorkItemAdditionalSidebarProperties component mentioned in the PR summary, which might handle overflow differently than the previous component.

web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.tsx (2)

6-6: Good addition of centralized rendering logic helper

The import of the shouldRenderColumn helper function enhances code maintainability by centralizing column rendering logic.


31-31: Nice refactoring to use the shared helper function

Replacing inline logic with the shouldRenderColumn helper function follows the DRY principle and makes the code more maintainable. This change ensures consistent handling of column rendering across components.

web/core/components/issues/issue-layouts/spreadsheet/issue-column.tsx (2)

10-10: Good addition of centralized rendering logic helper

Adding the import for the shouldRenderColumn helper maintains consistency with other components and improves code organization.


30-30: Nice refactoring to use the shared helper function

Replacing the inline logic with the shouldRenderColumn helper function follows the DRY principle and improves maintainability. This change ensures column rendering logic is consistent with other parts of the application.

web/ce/helpers/issue-filter.helper.ts (2)

20-23: Well-defined type for the helper function

Good practice to define a clear type with properly typed properties. The type signature makes it clear what parameters are required for the function.


25-33: Good implementation of the shared helper function

The shouldRenderColumn function is clean and focused. It centralizes the conditional logic for column rendering, making it easy to maintain and extend in the future. If more conditions need to be added for other column types, they can be easily incorporated into this switch statement.

web/ce/components/issues/issue-details/additional-properties.tsx (1)

7-14: Well-structured type definition

The type definition is clear and properly documents all required properties. The optional isPeekView property is nicely marked as such, allowing for flexibility in how the component is used.

web/core/components/issues/peek-overview/properties.tsx (2)

27-27: Updated import statement for the new component.

The import path reflects the new organizational structure, where the WorkItemAdditionalSidebarProperties component is located in the issue-details directory, making the code structure more intuitive.


294-301: Good replacement of IssueAdditionalPropertyValuesUpdate with WorkItemAdditionalSidebarProperties.

The refactoring replaces the conditional rendering of the IssueAdditionalPropertyValuesUpdate component with an unconditional rendering of WorkItemAdditionalSidebarProperties. This change:

  1. Uses consistent "workItem" terminology instead of "issue"
  2. Improves readability with better prop naming (e.g., isEditable instead of negating disabled)
  3. Adds context awareness with the isPeekView prop

These changes align well with the refactoring goal mentioned in the PR objectives.

web/core/components/issues/issue-detail/sidebar.tsx (2)

29-29: Updated import statement for the new component.

The import path for WorkItemAdditionalSidebarProperties follows the same pattern as in the peek-overview component, maintaining consistency across the codebase.


296-303: Good replacement of IssueAdditionalPropertyValuesUpdate with WorkItemAdditionalSidebarProperties.

This change mirrors the one made in the peek-overview component, creating a consistent interface across different views. The component:

  1. Uses the same prop structure as the peek-overview implementation
  2. Maintains the appropriate state with isEditable={isEditable} (directly passed through)
  3. Applies the same view context with isPeekView

This consistent implementation across different views improves maintainability and reduces cognitive load for developers working on the codebase.

web/core/store/issue/helpers/base-issues.store.ts (2)

40-40: New import for extended work item sorting functionality.

The import of workItemSortWithOrderByExtended introduces a dependency on a more specialized sorting function that's now separated into its own module, improving code organization.


1995-1995:

Details

❓ Verification inconclusive

Enhanced default case in issuesSortWithOrderBy to use the extended sorting function.

The default case now delegates to workItemSortWithOrderByExtended instead of simply returning getIssueIds(array). This change provides a more robust handling of sorting cases that don't match the predefined options, potentially supporting additional sorting criteria defined in the extended function.

Let's verify the implementation of workItemSortWithOrderByExtended to ensure it handles all possible cases properly:


🏁 Script executed:

#!/bin/bash
# Search for the implementation of workItemSortWithOrderByExtended
rg -A 10 "workItemSortWithOrderByExtended" --type=ts

Length of output: 2081


Attention: Extended Sorting Behavior Verification Needed

The default case now delegates to workItemSortWithOrderByExtended, which, upon verification, is implemented as a simple pass-through to getIssueIds(array) without utilizing the key or any additional sorting logic. This means that although the change was intended to provide a more robust handling of sorting cases, it currently does not support extended sorting criteria.

  • Confirm whether extended sorting logic based on the key is expected in this function.
  • If extended behavior is intended, please update the implementation accordingly.
  • Otherwise, document that returning getIssueIds(array) is the deliberate fallback behavior.

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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

🔭 Outside diff range comments (1)
web/core/components/issues/issue-layouts/spreadsheet/issue-column.tsx (1)

14-21: 🛠️ Refactor suggestion

Remove unused property from Props interface

The isEstimateEnabled property is defined in the Props interface but has been removed from the destructured props. This aligns with the previous code review comment about accessing this value from the store directly.

type Props = {
  displayProperties: IIssueDisplayProperties;
  issueDetail: TIssue;
  disableUserActions: boolean;
  property: keyof IIssueDisplayProperties;
  updateIssue: ((projectId: string | null, issueId: string, data: Partial<TIssue>) => Promise<void>) | undefined;
- isEstimateEnabled: boolean;
};
♻️ Duplicate comments (1)
web/core/components/issues/issue-detail/sidebar.tsx (1)

296-303: 🛠️ Refactor suggestion

Rename prop from workItemType to workItemTypeId

The prop name should be workItemTypeId instead of workItemType to maintain consistency with the renamed property across the codebase. This ensures type safety and aligns with the changes made in other components.

<WorkItemAdditionalSidebarProperties
  workItemId={issue.id}
- workItemType={issue.type_id}
+ workItemTypeId={issue.type_id}
  projectId={projectId}
  workspaceSlug={workspaceSlug}
  isEditable={isEditable}
  isPeekView
/>
🛑 Comments failed to post (4)
web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.tsx (2)

24-24: ⚠️ Potential issue

Parameter mismatch with shouldRenderColumn function

The function call to shouldRenderColumn only passes the property parameter, but according to the function definition in issue-filter.helper.ts, it expects an object of type TShouldRenderColumn with both key and isEstimateEnabled properties.

This parameter mismatch will likely cause runtime errors. The function call should be updated to match the expected parameter structure, or the function definition should be modified to accept just the property key.


19-19: 🛠️ Refactor suggestion

Property removal requires function parameter alignment

The isEstimateEnabled property has been removed from the destructured props, but the interface still includes it at line 13. This property is likely no longer needed as a prop since it seems the intention is to access it from the store context directly.

- interface Props {
-   displayProperties: IIssueDisplayProperties;
-   property: keyof IIssueDisplayProperties;
-   isEstimateEnabled: boolean;
-   displayFilters: IIssueDisplayFilterOptions;
-   handleDisplayFilterUpdate: (data: Partial<IIssueDisplayFilterOptions>) => void;
-   isEpic?: boolean;
- }
+ interface Props {
+   displayProperties: IIssueDisplayProperties;
+   property: keyof IIssueDisplayProperties;
+   displayFilters: IIssueDisplayFilterOptions;
+   handleDisplayFilterUpdate: (data: Partial<IIssueDisplayFilterOptions>) => void;
+   isEpic?: boolean;
+ }
📝 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.

interface Props {
  displayProperties: IIssueDisplayProperties;
  property: keyof IIssueDisplayProperties;
  displayFilters: IIssueDisplayFilterOptions;
  handleDisplayFilterUpdate: (data: Partial<IIssueDisplayFilterOptions>) => void;
  isEpic?: boolean;
}
web/core/components/issues/issue-layouts/spreadsheet/issue-column.tsx (1)

30-30: ⚠️ Potential issue

Parameter mismatch with shouldRenderColumn function

The function call to shouldRenderColumn only passes the property parameter, but according to the function definition in issue-filter.helper.ts, it expects an object of type TShouldRenderColumn with both key and isEstimateEnabled properties.

This parameter mismatch will likely cause runtime errors. The function call should be updated to match the expected parameter structure, or the function definition should be modified to accept just the property key.

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

20-33: ⚠️ Potential issue

Function implementation doesn't match its usage

The shouldRenderColumn function is defined to take a parameter of type TShouldRenderColumn with properties key and isEstimateEnabled, but it's being called with just a property key in the other files. Additionally, since the previous review mentioned accessing isEstimateEnabled from the store, this function should be updated to get that value directly from the store context.

Update the function to handle a single parameter and access isEstimateEnabled from the store:

- export type TShouldRenderColumn = {
-   key: keyof IIssueDisplayProperties;
-   isEstimateEnabled: boolean;
- };
- 
- export const shouldRenderColumn = (props: TShouldRenderColumn): boolean => {
-   const { key, isEstimateEnabled } = props;
+ export const shouldRenderColumn = (key: keyof IIssueDisplayProperties): boolean => {
+   const isEstimateEnabled = store.projectState.getProjectById(store.projectState?.currentProjectId)?.estimate;
  switch (key) {
    case "estimate":
      return isEstimateEnabled;
    default:
      return true;
  }
};

This change will align the function with how it's being called in the components and follows the suggestion to get isEstimateEnabled from the store directly.

📝 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.

};

export const shouldRenderColumn = (key: keyof IIssueDisplayProperties): boolean => {
  const isEstimateEnabled = store.projectState.getProjectById(store.projectState?.currentProjectId)?.estimate;
  switch (key) {
    case "estimate":
      return isEstimateEnabled;
    default:
      return true;
  }
};

@vamsikrishnamathala vamsikrishnamathala marked this pull request as draft March 12, 2025 07:52
@sriramveeraghanta sriramveeraghanta marked this pull request as ready for review March 17, 2025 10:13
@sriramveeraghanta sriramveeraghanta merged commit d4991b9 into preview Mar 17, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore-issue_filters_refactor branch March 17, 2025 10:15
@vamsikrishnamathala vamsikrishnamathala restored the chore-issue_filters_refactor branch March 18, 2025 12:52
@vamsikrishnamathala vamsikrishnamathala deleted the chore-issue_filters_refactor branch March 18, 2025 12:52
@vamsikrishnamathala vamsikrishnamathala restored the chore-issue_filters_refactor branch March 24, 2025 11:22
@sriramveeraghanta sriramveeraghanta deleted the chore-issue_filters_refactor branch May 2, 2025 09:28
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* chore: issue filters refactor

* chore: update helper funciton implementation

* chore: removed redundant components
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.

3 participants