Skip to content

[WEB-3396] chore: work items parent select improvement#6608

Merged
sriramveeraghanta merged 2 commits intopreviewfrom
chore-work-items-parent-select-improvement
Feb 14, 2025
Merged

[WEB-3396] chore: work items parent select improvement#6608
sriramveeraghanta merged 2 commits intopreviewfrom
chore-work-items-parent-select-improvement

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Feb 14, 2025

Description

This PR includes following changes:

  • Code splitting for Work Items Parent selection.

Type of Change

  • Code refactoring

References

[WEB-3396]

Summary by CodeRabbit

  • New Features

    • Introduced an enhanced parent issue selection component that improves the interface for linking and managing parent and sub-issues.
  • Refactor

    • Updated multiple views to integrate the new component, streamlining the update process and ensuring consistent dynamic linking for parent issues.
    • Improved component import organization to enhance code readability and maintain a uniform experience across issue detail interfaces.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2025

Walkthrough

This pull request introduces a new React component, IssueParentSelectRoot, and updates export statements to include the new module in both the CE and EE directories. The old IssueParentSelect component’s internal logic is replaced by external asynchronous handlers for managing parent selection and sub-issue removal. Additionally, component imports and type declarations have been updated across multiple files, with some import formatting changes made for clarity. The modifications affect various parts of the issues module without altering the fundamental structure of the existing components.

Changes

Files Change Summary
web/ce/components/issues/issue-details/index.ts
web/ee/components/issues/issue-details/index.ts
Added export for the newly introduced parent-select-root module.
web/ce/components/issues/issue-details/parent-select-root.tsx
web/ee/components/issues/issue-details/parent-select-root.tsx
Introduced IssueParentSelectRoot as a new React functional component; the EE file re-exports the CE component.
web/core/components/issues/issue-detail/parent-select.tsx Removed the internal issueOperations property and logic; added asynchronous handlers handleParentIssue and handleRemoveSubIssue and introduced a new property workItemLink in the type declaration.
web/core/components/issues/issue-detail/root.tsx Reformatted import statements for better readability; no functional changes.
web/core/components/issues/issue-detail/sidebar.tsx Replaced usage of IssueParentSelect with the new IssueParentSelectRoot component by updating the import and component instantiation.
web/core/components/issues/peek-overview/properties.tsx Updated the import to remove IssueParentSelect and IssueModuleSelect; replaced IssueParentSelect with IssueParentSelectRoot in the component usage, streamlining the import and component structure.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant Root as IssueParentSelectRoot
    participant Handler as External Handler
    participant Data as Data Layer/API

    User->>Root: Triggers parent issue selection
    Root->>Handler: Call handleParentIssue(newParentId)
    Handler->>Data: Update parent issue and fetch sub-issues
    Data-->>Handler: Return update result
    Handler-->>Root: Notify completion
    Root->>User: Render updated parent issue link

    User->>Root: Triggers removal of sub-issue
    Root->>Handler: Call handleRemoveSubIssue(workspaceSlug, projectId, parentIssueId, issueId)
    Handler->>Data: Remove sub-issue and fetch updates
    Data-->>Handler: Return updated sub-issues
    Handler-->>Root: Notify completion
    Root->>User: Render updated sub-issues list
Loading

Possibly related PRs

Suggested labels

🌐frontend, 🧹chore, 🛠️refactor

Suggested reviewers

  • sriramveeraghanta
  • SatishGandham
  • rahulramesha

Poem

Hop along the bytes so bright,
A new component takes flight.
Exports updated, handlers set,
Our code’s a bunny, you can bet!
With each hop the bugs take flight,
Celebrating changes with delight!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • 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. (Beta)
  • @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.

@anmolsinghbhatia anmolsinghbhatia marked this pull request as ready for review February 14, 2025 13:42
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 (2)
web/core/components/issues/issue-detail/parent-select.tsx (1)

27-34: Consider documenting these new handler props.
It’s great that the component now delegates parent issue handling and sub-issue removal to external functions. As a future enhancement, consider adding brief doc comments to clarify usage and outline any error-handling expectations for these asynchronous methods.

web/ce/components/issues/issue-details/parent-select-root.tsx (1)

57-60: Consider using a try-finally block for loader state.

The loader state might not be reset if an error occurs, as it's set after the async operations.

Apply this diff to ensure the loader state is always reset:

  try {
    setSubIssueHelpers(parentIssueId, "issue_loader", issueId);
    await removeSubIssue(workspaceSlug, projectId, parentIssueId, issueId);
    await fetchSubIssues(workspaceSlug, projectId, parentIssueId);
-   setSubIssueHelpers(parentIssueId, "issue_loader", issueId);
+  } finally {
+    setSubIssueHelpers(parentIssueId, "issue_loader", issueId);
  }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c4a3e1e and e2e2f19.

📒 Files selected for processing (8)
  • web/ce/components/issues/issue-details/index.ts (1 hunks)
  • web/ce/components/issues/issue-details/parent-select-root.tsx (1 hunks)
  • web/core/components/issues/issue-detail/parent-select.tsx (3 hunks)
  • web/core/components/issues/issue-detail/root.tsx (1 hunks)
  • web/core/components/issues/issue-detail/sidebar.tsx (3 hunks)
  • web/core/components/issues/peek-overview/properties.tsx (2 hunks)
  • web/ee/components/issues/issue-details/index.ts (1 hunks)
  • web/ee/components/issues/issue-details/parent-select-root.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • web/ee/components/issues/issue-details/parent-select-root.tsx
  • web/core/components/issues/issue-detail/root.tsx
🔇 Additional comments (8)
web/core/components/issues/issue-detail/parent-select.tsx (4)

9-9: No concerns with the new Tooltip import.
Looks good and aligns well with existing patterns.


38-47: Destructuring of props looks clean.
All defaults are appropriately assigned where needed, and the naming conventions are consistent.


54-54: Modal state derivation is straightforward.
No issues with retrieving modal state from the store.


92-92: Verify link safety.
Since workItemLink is used in a new tab, ensure that it’s valid and non-empty to avoid unexpected redirects or 404 pages. Great job including rel="noopener noreferrer".

web/ce/components/issues/issue-details/index.ts (1)

5-5: New export statement confirmed.
Exporting parent-select-root extends modular reuse. No concerns here.

web/ee/components/issues/issue-details/index.ts (1)

5-5: Export statement addition looks consistent.
Mirrors the CE implementation and maintains parity between editions.

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

266-273: LGTM! Clean implementation of the new IssueParentSelectRoot component.

The component replacement is properly implemented with all required props passed correctly.

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

264-271: LGTM! Consistent implementation across components.

The IssueParentSelectRoot component is properly integrated with the same props pattern as in other files.

@sriramveeraghanta sriramveeraghanta merged commit 8a792d3 into preview Feb 14, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore-work-items-parent-select-improvement branch February 14, 2025 23:35
@coderabbitai coderabbitai bot mentioned this pull request Mar 24, 2025
6 tasks
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* chore: work items parent select improvements

* chore: code refactor
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