Skip to content

Fix include done switch bug and add shimmer for table#160

Merged
iamitprakash merged 3 commits intoRealDevSquad:developfrom
Hariom01010:fix/include-done-button
Jul 26, 2025
Merged

Fix include done switch bug and add shimmer for table#160
iamitprakash merged 3 commits intoRealDevSquad:developfrom
Hariom01010:fix/include-done-button

Conversation

@Hariom01010
Copy link
Contributor

@Hariom01010 Hariom01010 commented Jul 25, 2025

Date: 26 Jul 2025

Developer Name: @Hariom01010


Issue Ticket Number

Closes #159

Description

This PR addresses two key issues on the Dashboard:

  1. Fix: "Include Done" switch not rendered on initial load
    Previously, the switch to include completed tasks was not rendered due to an incorrect condition check during the initial load. This has now been fixed to ensure the toggle always appears as expected.

  2. Improved: Shimmer loading behavior

    • On initial page load, the full-page shimmer is displayed as intended.

    • On subsequent data refetches (e.g., when toggling the switch), only the table area shows the shimmer. This avoids unnecessary UI flicker and improves the perceived performance and UX.

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1
include-done-bug-fix.mp4

Test Coverage

Screenshot 1

Additional Notes

Description by Korbit AI

What change is being made?

Fix the bug related to the "include done" switch in the To-Do list and add a shimmer loading effect for the table UI for better user experience during data loading.

Why are these changes being made?

The bug was causing incorrect status handling when switching tasks views, and the shimmer effect allows users to perceive loading activity, enhancing user experience by indicating that content is being loaded asynchronously. This approach improves UI responsiveness and addresses specific conditions where task views were not properly updating due to faulty status management.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

@Hariom01010 Hariom01010 requested a review from yesyash July 25, 2025 23:16
@Hariom01010 Hariom01010 self-assigned this Jul 25, 2025
@Hariom01010 Hariom01010 added the bug Something isn't working label Jul 25, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 25, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Summary by CodeRabbit

  • New Features

    • Improved loading experience with shimmer placeholders displayed during both initial loading and when placeholder data is present.
    • "Include Done" switch is now visible on all tabs except the "WatchList" tab.
  • Bug Fixes

    • Enhanced error handling to display an error page for invalid combinations of tab and status URL parameters.
  • Chores

    • URL query parameters now stay in sync with tab and filter selections for a more consistent navigation experience.

Walkthrough

The changes extend several dashboard and todo table components to support a new isPlaceholderData prop, allowing shimmer placeholders to be shown during data refetches without affecting the entire page. The "Include Done" switch rendering logic is adjusted to always show except on the WatchList tab. URL query parameter handling is improved for tab and filter synchronization.

Changes

File(s) Change Summary
components/todo-list-table.tsx Added isPlaceholderData prop to types and components; shimmer shown on loading or placeholder data; switch logic updated.
modules/dashboard/components/dashboard-tabs.tsx Added isPlaceholderData prop to props and component; passed to child table; improved tab change and URL param logic.
modules/dashboard/components/dashboard-watchlist-table.tsx Added client mode; used URL params to detect invalid state; error shown for invalid tab/status; debug logging added.
modules/dashboard/index.tsx Synced "include done" state with URL; used isPlaceholderData for shimmer logic; improved loading/placeholder handling.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Dashboard
    participant TodoListTable
    participant TodoListTableBody

    User->>Dashboard: Loads dashboard or toggles "Include Done"
    Dashboard->>TodoListTable: Passes tasks, isPlaceholderData, includeDone
    TodoListTable->>TodoListTableBody: Passes isLoading, isPlaceholderData
    alt isLoading or isPlaceholderData
        TodoListTableBody->>User: Show shimmer rows
    else
        TodoListTableBody->>User: Show actual task rows
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #158: Both PRs modify TodoListTable and related props for the "Include Done" switch, focusing on its UI and logic.
  • #131: Both PRs involve changes to the usage and rendering of TodoListTable in the dashboard context, affecting its integration and update logic.

Suggested reviewers

  • yesyash

Poem

In the dashboard patch, a shimmer appears,
Only for tasks—not the whole page, cheers!
"Include Done" now shines, as it rightly should,
Tabs and filters sync as a dashboard would.
A hop, a tweak, a bug undone—
This rabbit’s review is nearly done! 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Logging Development logging in production code ▹ view ✅ Fix detected
Readability Unexplained Magic Number ▹ view
Logging Debug Log in Production ▹ view ✅ Fix detected
Functionality Incomplete URL Status Parameter Management ▹ view ✅ Fix detected
Error Handling Incorrect Error Handling for Invalid URL Parameters ▹ view
Files scanned
File Path Reviewed
modules/dashboard/components/dashboard-watchlist-table.tsx
modules/dashboard/components/dashboard-tabs.tsx
modules/dashboard/index.tsx
components/todo-list-table.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Comment on lines +30 to 32
if (isError || isInvalidCombination) {
return <CommonPageError />
}
Copy link

Choose a reason for hiding this comment

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

Incorrect Error Handling for Invalid URL Parameters category Error Handling

Tell me more
What is the issue?

Using CommonPageError for an invalid combination of URL parameters is inappropriate as it suggests a system error rather than a user navigation error.

Why this matters

Users encountering this error won't understand why they're seeing a generic error page when they've simply accessed an invalid URL combination. This could lead to confusion and unnecessary support tickets.

Suggested change ∙ Feature Preview

Create a specific error component for invalid URL parameters or redirect to a valid state:

if (isError) {
    return <CommonPageError />
}

if (isInvalidCombination) {
    return <div>Cannot view completed tasks in Watchlist view</div>
    // Or redirect to a valid state:
    // router.replace('/dashboard?tab=watchlist')
}
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

Copy link

@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: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cc4d717 and c07a351.

📒 Files selected for processing (4)
  • components/todo-list-table.tsx (5 hunks)
  • modules/dashboard/components/dashboard-tabs.tsx (3 hunks)
  • modules/dashboard/components/dashboard-watchlist-table.tsx (2 hunks)
  • modules/dashboard/index.tsx (2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: shubhdevelop
PR: Real-Dev-Squad/todo-frontend#35
File: components/SimmerSkeleton.tsx:0-0
Timestamp: 2025-03-16T10:34:22.088Z
Learning: The shimmer component in the todo app should maintain the app's color palette (white, indigo-50) without making colors configurable, as it's designed specifically for this application.
modules/dashboard/components/dashboard-watchlist-table.tsx (1)

Learnt from: yesyash
PR: #109
File: app/(internal-routes)/teams/[teamId]/layout.tsx:8-15
Timestamp: 2025-07-16T13:18:36.847Z
Learning: In Next.js layout components, error handling and validation for params extraction (like const { teamId } = await params) is not required in this codebase. The framework handles routing validation adequately.

components/todo-list-table.tsx (1)

Learnt from: shubhdevelop
PR: #35
File: components/SimmerSkeleton.tsx:0-0
Timestamp: 2025-03-16T10:34:22.088Z
Learning: The shimmer component in the todo app should maintain the app's color palette (white, indigo-50) without making colors configurable, as it's designed specifically for this application.

modules/dashboard/index.tsx (1)

Learnt from: yesyash
PR: #109
File: app/(internal-routes)/teams/[teamId]/layout.tsx:8-15
Timestamp: 2025-07-16T13:18:36.847Z
Learning: In Next.js layout components, error handling and validation for params extraction (like const { teamId } = await params) is not required in this codebase. The framework handles routing validation adequately.

🔇 Additional comments (14)
modules/dashboard/components/dashboard-watchlist-table.tsx (3)

1-1: LGTM: Correct client directive usage.

The 'use client' directive is properly placed to enable client-side hooks usage.


7-8: LGTM: Proper Next.js navigation imports.

The imports are correctly added to support URL parameter reading functionality.


30-32: LGTM: Proper error handling for invalid parameter combinations.

The updated condition correctly handles both API errors and invalid URL parameter combinations, which aligns with the PR objective to fix the Include Done switch behavior.

modules/dashboard/components/dashboard-tabs.tsx (3)

15-15: LGTM: Proper prop interface extension.

The isPlaceholderData prop is correctly added to the component interface and destructuring, enabling shimmer control functionality.

Also applies to: 23-23


34-41: LGTM: Well-implemented URL parameter synchronization.

The enhanced tab change logic properly manages URL parameters:

  • Removes status parameter when switching to WatchList tab
  • Sets status to 'Done' for other tabs when includeDone is true
  • Maintains clean URL state management

This correctly implements the PR objective to fix Include Done switch behavior.


66-66: LGTM: Proper prop propagation for shimmer control.

The isPlaceholderData prop is correctly passed to TodoListTable to enable table-level shimmer loading control.

modules/dashboard/index.tsx (5)

7-9: LGTM: Proper imports for enhanced functionality.

The imports correctly support URL parameter management, placeholder data handling, and React hooks usage.


16-22: LGTM: Proper URL-driven state initialization.

The implementation correctly:

  • Reads URL parameters to initialize state
  • Uses useRef to track first load for shimmer behavior
  • Initializes includeDoneTasks based on URL status parameter

This aligns with the PR objective to fix Include Done switch rendering.


23-33: LGTM: Well-implemented bidirectional URL synchronization.

The change handler properly:

  • Updates local state
  • Synchronizes URL parameters with state changes
  • Maintains clean URL parameter management

This ensures consistent state between URL and component state.


48-50: LGTM: Correct loading condition for first load shimmer.

The condition properly shows full-page shimmer only on the first load, implementing the PR objective to improve shimmer behavior for better UX.


67-69: LGTM: Proper prop passing for enhanced functionality.

The props are correctly passed to enable:

  • Table-level shimmer control via isPlaceholderData
  • Bidirectional state management via the updated change handler
components/todo-list-table.tsx (3)

88-88: LGTM: Proper shimmer control implementation.

The isPlaceholderData prop is correctly added to the interface and the shimmer rendering logic properly includes both loading and placeholder data states. This enables table-level shimmer during data refetches as intended.

Also applies to: 95-98


146-146: LGTM: Correct prop propagation through component hierarchy.

The isPlaceholderData prop is properly:

  • Added to the TodoListTable interface
  • Destructured in the component
  • Passed down to TodoListTableBody

This enables the shimmer control functionality throughout the table component tree.

Also applies to: 155-155, 219-219


199-199: LGTM: Fixed Include Done switch visibility condition.

The condition change from currentTab === DashboardTasksTableTabs.All to currentTab !== DashboardTasksTableTabs.WatchList correctly implements the PR objective to fix the Include Done switch bug. The switch now appears on all tabs except WatchList, which aligns with the URL parameter logic implemented in other components.

@iamitprakash iamitprakash merged commit 4837adb into RealDevSquad:develop Jul 26, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard: "Include Done" switch not rendered on initial load + full-page shimmer shown on switch toggle

2 participants