Skip to content

[WEB-3361] fix: home recent n progress#6648

Merged
sriramveeraghanta merged 1 commit intopreviewfrom
fix-home-recent-n-progress
Feb 19, 2025
Merged

[WEB-3361] fix: home recent n progress#6648
sriramveeraghanta merged 1 commit intopreviewfrom
fix-home-recent-n-progress

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Feb 19, 2025

Description

This PR fixes the issue with the home recent items n progress bug.

Type of Change

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

References

[WEB-3361]

Summary by CodeRabbit

  • New Features

    • Introduced options to assign a unique identifier and manage progress indicator behavior on interactive items, enhancing configurability.
  • Refactor

    • Streamlined the rendering logic within list components for improved code clarity and maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 19, 2025

Walkthrough

This pull request adds two new optional properties—id and preventDefaultNProgress—to the IListItemProps interface in list-item.tsx. In addition, the RecentIssue component is updated to pass these properties to the ListItem component, with a dynamically generated id from issue details. The changes also streamline class name rendering in the Row component and conditionally add a data attribute to control NProgress behavior without modifying existing functionality.

Changes

File(s) Change Summary
web/core/components/core/list/list-item.tsx Added optional id and preventDefaultNProgress properties to the IListItemProps interface; updated prop destructuring; passed id to ControlLink and conditionally added data-prevent-nprogress; simplified class name rendering in Row.
web/core/components/home/widgets/recents/issue.tsx Updated the RecentIssue component to pass a dynamic id (from issueDetails?.id) and preventDefaultNProgress to the ListItem component.

Sequence Diagram(s)

sequenceDiagram
    participant RI as RecentIssue
    participant LI as ListItem
    participant CL as ControlLink

    RI->>LI: Pass props (id, preventDefaultNProgress, others)
    LI->>CL: Forward id and conditionally add data-prevent-nprogress
    CL-->>LI: Render with updated attributes
Loading

Possibly related PRs

Suggested reviewers

  • sriramveeraghanta

Poem

I'm just a little rabbit in the code burrow,
Hopping on changes with a joyful glow.
New props dance in the ListItem field,
With id and preventDefaultNProgress revealed.
I nibble through bugs and leap so high—
CodeRabbit cheers as the features fly! 🐰✨


📜 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 dd11ebf and dcd9f93.

📒 Files selected for processing (2)
  • web/core/components/core/list/list-item.tsx (4 hunks)
  • web/core/components/home/widgets/recents/issue.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (6)
web/core/components/core/list/list-item.tsx (4)

11-11: LGTM! Interface changes maintain backward compatibility.

The new optional properties id and preventDefaultNProgress are well-named and have appropriate types.

Also applies to: 26-26


31-31: LGTM! Props destructuring is correct.

The new props are properly destructured with appropriate default values.

Also applies to: 46-46


63-63: LGTM! Simplified className logic.

The className logic has been streamlined without changing functionality.


69-69:

Details

❓ Verification inconclusive

Verify NProgress behavior with the new data attribute.

The changes look good, but let's verify that NProgress is correctly controlled by the new attribute.

Also applies to: 75-75


🌐 Web query:

How does NProgress handle data-prevent-nprogress attribute in Next.js applications?

💡 Result:

In Next.js applications using NProgress integration packages like next-nprogress-bar, the data-prevent-nprogress={true} attribute stops the progress bar from initiating during specific navigation events[1][3]. This attribute is particularly useful when you want to bypass the default loading indicator behavior for particular interactions.

Implementation details:

  • Added directly to DOM elements like <span> or <a> tags within Next.js <Link> components
  • Works by intercepting click events before they trigger route changes[1][3]
  • Particularly effective for elements that use e.preventDefault() in click handlers[1]

Example usage:

<Link href="/dashboard">
  <span>Dashboard</span>
  <span 
    onClick={(e) => e.preventDefault()}
    data-prevent-nprogress={true}
  >
    Prevent Progress
  </span>
</Link>

Key behaviors:

  1. Prevents NProgress initialization when clicking the marked element[1][3]
  2. Maintains default progress bar behavior for other navigation interactions
  3. Compatible with both Next.js App Router and Pages Router architectures[1][7]

This approach provides granular control over progress indicators while maintaining standard loading behavior for most navigation events[1][3]. The same packages also support data-disable-nprogress={true} for completely disabling progress tracking on specific links[1][3].

Citations:


NProgress Behavior Verification Required

The changes in web/core/components/core/list/list-item.tsx look correct: the id prop at line 69 is properly passed and the new data-prevent-nprogress={preventDefaultNProgress} attribute at line 75 should effectively stop the progress bar for specific interactions—as intended by Next.js integrations (e.g., with packages like next-nprogress-bar).

  • File: web/core/components/core/list/list-item.tsx
    • Line 69: Ensure the id={id} prop continues to serve its purpose.
    • Line 75: Confirm that data-prevent-nprogress={preventDefaultNProgress} correctly prevents NProgress initialization during certain navigation events.

Please verify in your environment that clicking elements with the data-prevent-nprogress attribute indeed bypasses the default progress bar behavior.

web/core/components/home/widgets/recents/issue.tsx (2)

46-46: LGTM! Clear and consistent id format.

The dynamically generated id follows a clear pattern and handles null cases correctly.


117-117: LGTM! Progress indicator behavior aligns with click handling.

The preventDefaultNProgress prop is correctly used to prevent the progress indicator when the click is handled by setPeekIssue.


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.

@sriramveeraghanta sriramveeraghanta merged commit 3de655c into preview Feb 19, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-home-recent-n-progress branch February 19, 2025 12:34
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛bug Something isn't working 🌐frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants