Skip to content

[WEB-4283] fix: update group key handling in issue store utilities for state groups#7191

Merged
sriramveeraghanta merged 2 commits intopreviewfrom
fix-state-group-layout
Jun 10, 2025
Merged

[WEB-4283] fix: update group key handling in issue store utilities for state groups#7191
sriramveeraghanta merged 2 commits intopreviewfrom
fix-state-group-layout

Conversation

@prateekshourya29
Copy link
Member

@prateekshourya29 prateekshourya29 commented Jun 9, 2025

Description

  • Newly created work items don’t appear immediately when grouped by state group, they only show up after a page refresh.
  • Updating a work item's group doesn’t reflect in the UI when grouped by state group.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Summary by CodeRabbit

  • Refactor
    • Simplified and updated grouping and filtering options for issue pages, particularly for draft and archived issues.
    • Improved internal handling of issue grouping logic, resulting in more consistent and reliable grouping behavior in issue lists.
    • Enhanced clarity in how groupings are displayed and managed across issue views.

- Introduced a new function to determine the default group key based on the provided groupByKey.
- Updated references to use the new function for improved clarity and maintainability.
- Adjusted the mapping for "state_detail.group" in the ISSUE_GROUP_BY_KEY to ensure consistency.
- Enhanced the getArrayStringArray method to handle group values more effectively.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 9, 2025

Walkthrough

This update refactors the issue grouping and filtering logic by simplifying group-by options, adjusting group key mappings, and improving value handling for the "state_detail.group" key. It removes specific configurations for archived and draft issues, introduces helper functions for group key/value normalization, and clarifies variable naming for better maintainability.

Changes

File(s) Change Summary
packages/constants/src/issue/filter.ts Removed archived/draft issue filter configs; simplified kanban group_by options for draft issues.
web/core/store/issue/helpers/base-issues-utils.ts Replaced direct group key lookup with new getDefaultGroupKey helper; removed unused import.
web/core/store/issue/helpers/base-issues.store.ts Changed group key/value mappings for "state_detail.group"; introduced getDefaultGroupValue helper; improved variable naming.

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant Store
    participant Utils

    UI->>Store: Request grouped issue IDs (groupByKey)
    Store->>Utils: getDefaultGroupKey(groupByKey)
    Utils-->>Store: Return normalized group key
    Store->>Store: getDefaultGroupValue(issue, value, groupByKey)
    Store-->>UI: Return grouped issue IDs
Loading

Possibly related PRs

Suggested labels

🐛bug, ready_to_merge

Suggested reviewers

  • sriramveeraghanta

Poem

In the meadow of code, a rabbit leaps high,
Refactoring filters as clouds drift by.
Group keys now clearer, the logic refined,
Old configs are gone, new helpers aligned.
With every hop, the issues sort true—
A tidy warren for devs, from me to you! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • @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 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

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

@makeplane
Copy link

makeplane bot commented Jun 9, 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: 0

🧹 Nitpick comments (1)
web/core/store/issue/helpers/base-issues.store.ts (1)

1693-1713: Consider improving the method delegation and documentation.

The refactoring of getArrayStringArray to delegate to getDefaultGroupValue is good, but the current implementation could be cleaner:

  getArrayStringArray = (
    issueObject: Partial<TIssue> | undefined,
    value: string | string[] | undefined | null,
    groupByKey?: TIssueGroupByOptions | undefined
  ): string[] => {
    // if issue object is undefined return empty array
    if (!issueObject) return [];
    // if value is not defined, return None value in array
    if (!value || isEmpty(value)) return ["None"];
    // if array return the array
    if (Array.isArray(value)) return value;

-   return this.getDefaultGroupValue(issueObject, value, groupByKey);
+   // Handle single string values
+   return this.getDefaultGroupValue(issueObject, value, groupByKey);
  };

Also, consider updating the JSDoc comments to reflect the new delegation pattern and the special handling for state groups.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9965f48 and ce45472.

📒 Files selected for processing (3)
  • packages/constants/src/issue/filter.ts (1 hunks)
  • web/core/store/issue/helpers/base-issues-utils.ts (1 hunks)
  • web/core/store/issue/helpers/base-issues.store.ts (6 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
web/core/store/issue/helpers/base-issues-utils.ts (2)
packages/types/src/view-props.d.ts (1)
  • TIssueGroupByOptions (5-17)
web/core/store/issue/helpers/base-issues.store.ts (2)
  • ISSUE_GROUP_BY_KEY (121-133)
  • groupBy (311-322)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (7)
web/core/store/issue/helpers/base-issues-utils.ts (2)

320-330: LGTM: Well-structured helper function with clear special case handling.

The getDefaultGroupKey helper function centralizes the group key mapping logic and correctly handles the special case for "state_detail.group" by returning "state__group" instead of using the constant mapping. This aligns with the PR objective to fix state group display issues.


333-335: Improve null safety with cleaner logic.

The changes improve null safety by using the helper function and handling the null case more explicitly. The logic correctly handles when groupKey is null by setting value to null.

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

139-139:

Details

✅ Verification successful

Verify the impact of removing grouping options.

The group_by array has been simplified by removing "state_detail.group" and "project" options. While this aligns with the refactoring objectives, please ensure this change doesn't break existing functionality for users who may be using these grouping options on archived issues.


🏁 Script executed:

#!/bin/bash
# Description: Check if archived issues still use the removed grouping options elsewhere in the codebase

# Search for usage of state_detail.group with archived issues
rg -A 3 -B 3 "state_detail\.group.*archived|archived.*state_detail\.group"

# Search for project grouping with archived issues  
rg -A 3 -B 3 "project.*archived_issues|archived_issues.*project" --type ts

Length of output: 1515


No references to removed grouping options found – change is safe.

Ripgrep searches for "state_detail.group" and "project" in the context of archived issues returned no matches. Removing these options from archived_issues.list.display_filters.group_by will not break existing functionality.

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

140-140: Ensure consistency in the ISSUE_FILTER_DEFAULT_DATA mapping.

The mapping has been updated from "state_group" to "state__group". Please verify this change is intentional and aligns with the data structure expectations throughout the codebase.


597-597: Excellent variable naming improvement.

The rename from issueGroupKey to issueGroupKeyValue better reflects that this variable holds the value of the issue property rather than the key itself. This improves code clarity and maintainability.


1721-1732: Well-implemented helper method with proper state group handling.

The new getDefaultGroupValue method correctly handles the special case for "state_detail.group" by looking up the state group from the state map and falling back to the issue's state__group property. This appears to be the core fix for the issue where work items weren't appearing immediately when grouped by state group.

The implementation is solid with proper fallback logic.


124-124:

Details

✅ Verification successful

Verify the mapping change aligns with the new group key logic.

The mapping for "state_detail.group" has been changed from "state__group" to "state_id". This change should align with the new helper function in base-issues-utils.ts that returns "state__group" for this key. Please ensure this mapping change is correct and consistent with the overall refactoring.


🏁 Script executed:

#!/bin/bash
# Description: Verify consistency between the mapping changes and helper function usage

# Check how ISSUE_GROUP_BY_KEY is used with state_detail.group
rg -A 5 -B 5 "ISSUE_GROUP_BY_KEY.*state_detail\.group|state_detail\.group.*ISSUE_GROUP_BY_KEY"

# Check usage of getDefaultGroupKey function  
rg -A 5 -B 5 "getDefaultGroupKey"

Length of output: 1928


🏁 Script executed:

#!/bin/bash
# Print context around ISSUE_GROUP_BY_KEY and related mappings
echo "=== ISSUE_GROUP_BY_KEY ==="
rg -C5 'ISSUE_GROUP_BY_KEY' -n web/core/store/issue/helpers/base-issues.store.ts

echo
echo "=== state_detail.group mapping ==="
rg -C3 'state_detail\.group' -n web/core/store/issue/helpers/base-issues.store.ts

echo
echo "=== ISSUE_FILTER_DEFAULT_DATA ==="
rg -C5 'ISSUE_FILTER_DEFAULT_DATA' -n web/core/store/issue/helpers/base-issues.store.ts

Length of output: 2938


Mapping for “state_detail.group” is correct and consistent with the refactoring

The updated ISSUE_GROUP_BY_KEY["state_detail.group"] = "state_id" aligns with the new getDefaultGroupKey helper—which special-cases this key to return "state__group" when grouping—and the unchanged ISSUE_FILTER_DEFAULT_DATA["state_detail.group"] = "state__group" for default filters. No further changes are needed.

@sriramveeraghanta sriramveeraghanta merged commit 6adc721 into preview Jun 10, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-state-group-layout branch June 10, 2025 08:26
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
…r state groups (#7191)

* fix: update group key handling in issue store utilities for state groups

- Introduced a new function to determine the default group key based on the provided groupByKey.
- Updated references to use the new function for improved clarity and maintainability.
- Adjusted the mapping for "state_detail.group" in the ISSUE_GROUP_BY_KEY to ensure consistency.
- Enhanced the getArrayStringArray method to handle group values more effectively.

* refactor: clean up filters constants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants