Skip to content

feat: enhance infinite scroll column merging in TableWidgetV2#40610

Merged
rahulbarwal merged 1 commit intoreleasefrom
rahulbarwal/40457/handle-column-order-changes
May 12, 2025
Merged

feat: enhance infinite scroll column merging in TableWidgetV2#40610
rahulbarwal merged 1 commit intoreleasefrom
rahulbarwal/40457/handle-column-order-changes

Conversation

@rahulbarwal
Copy link
Contributor

@rahulbarwal rahulbarwal commented May 8, 2025

Description

Problem
Existing columns could be lost during data updates when infinite scroll was enabled, leading to inconsistent table display.

Root cause
New column data from paginated responses was replacing the existing column state instead of merging with it.

Solution
This PR handles enhancing the column merging logic in infinite scroll mode by combining new columns with existing ones, ensuring consistent and complete column display across paginated data updates.

Fixes #40457
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.Table"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14905173364
Commit: cb86d0f
Cypress dashboard.
Tags: @tag.Table
Spec:


Thu, 08 May 2025 11:53:39 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of table columns when infinite scroll is enabled, ensuring columns remain consistent and preventing data issues as new pages are loaded.

This update introduces logic to merge new columns with existing ones when infinite scroll is enabled. This ensures that the table maintains consistent data display by preventing the loss of existing columns during data updates.
@rahulbarwal rahulbarwal requested a review from a team as a code owner May 8, 2025 11:14
@rahulbarwal rahulbarwal requested review from vivek-appsmith and removed request for a team May 8, 2025 11:14
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 8, 2025

Walkthrough

The createTablePrimaryColumns method in the TableWidgetV2 class was updated to handle infinite scroll scenarios by merging existing and new primary columns instead of replacing them. This ensures column consistency during infinite scroll events, such as resizing or toggling the infinite scroll feature. No public API signatures were changed.

Changes

File(s) Change Summary
app/client/src/widgets/TableWidgetV2/widget/index.tsx Modified createTablePrimaryColumns to merge columns when infiniteScrollEnabled is true, ensuring consistency during infinite scroll.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TableWidgetV2
    participant DataSource

    User->>TableWidgetV2: Enable infinite scroll or resize table
    TableWidgetV2->>DataSource: Fetch new data page
    TableWidgetV2->>TableWidgetV2: Call createTablePrimaryColumns
    alt infiniteScrollEnabled
        TableWidgetV2->>TableWidgetV2: Merge existing and new columns
    else not infiniteScrollEnabled
        TableWidgetV2->>TableWidgetV2: Replace columns if IDs differ
    end
    TableWidgetV2-->>User: Render table with consistent columns
Loading

Assessment against linked issues

Objective Addressed Explanation
Prevent data from going missing during infinite scroll, resize, or toggling (40411)

Possibly related PRs

  • appsmithorg/appsmith#40609: Also modifies TableWidgetV2 for improved infinite scroll handling, focusing on reset logic.
  • appsmithorg/appsmith#40066: Alters TableWidgetV2 to address state reset and updates linked to infinite scroll, targeting related internal logic.

Suggested labels

Enhancement, Widgets Product, Table Widget V2, ok-to-test, Query Widgets & IDE Pod

Suggested reviewers

  • jacquesikot
  • AmanAgarwal041

Poem

When tables scroll on without end,
And columns would vanish, then re-extend,
A merge now keeps all in line—
No data lost, the view is fine!
Infinite rows, no more fright,
TableWidgetV2 shines bright!
🌟🧮

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c53166 and cb86d0f.

📒 Files selected for processing (1)
  • app/client/src/widgets/TableWidgetV2/widget/index.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (4)
app/client/src/widgets/TableWidgetV2/widget/index.tsx (4)

640-644: Appropriate addition of infiniteScrollEnabled prop

Good extraction of the infiniteScrollEnabled property for the column handling logic.


702-723: Well-implemented logic for column merging in infinite scroll

The added logic properly addresses the infinite scroll issue by merging columns instead of replacing them. The implementation ensures that when infinite scroll is enabled, columns from new data pages are combined with existing columns rather than overwriting them. This prevents column inconsistency when scrolling through data.

The code is well-documented with clear comments explaining the rationale behind this approach.


1073-1083: Effective reset logic for infinite scroll

The conditional check for when to reset the table for infinite scroll is appropriate. Triggering the reset when either:

  1. Infinite scroll setting changes, or
  2. Component height changes while infinite scroll is enabled

This ensures consistent table display when these properties change.


3093-3096: Proper table reset implementation

The implementation correctly resets the widget state and updates the page number to ensure clean rendering when infinite scroll settings change.

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

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.

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.

@rahulbarwal rahulbarwal self-assigned this May 8, 2025
@github-actions github-actions bot added Bug Something isn't working High This issue blocks a user from building or impacts a lot of users Low An issue that is neither critical nor breaks a user flow Needs Triaging Needs attention from maintainers to triage QA Needs QA attention Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE Release Table Widget V2 Issues related to Table Widget V2 Widgets Product This label groups issues related to widgets labels May 8, 2025
@rahulbarwal rahulbarwal requested a review from AmanAgarwal041 May 8, 2025 11:14
@github-actions github-actions bot added Enhancement New feature or request and removed Bug Something isn't working labels May 8, 2025
@rahulbarwal rahulbarwal added Bug Something isn't working ok-to-test Required label for CI and removed Enhancement New feature or request labels May 8, 2025
@github-actions github-actions bot added Enhancement New feature or request Bug Something isn't working PR blocker Critical issues raised during feature testing & need to be fixed before PR is pushed to master and removed Bug Something isn't working labels May 8, 2025
@rahulbarwal rahulbarwal merged commit 3552e47 into release May 12, 2025
54 checks passed
@rahulbarwal rahulbarwal deleted the rahulbarwal/40457/handle-column-order-changes branch May 12, 2025 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request High This issue blocks a user from building or impacts a lot of users Low An issue that is neither critical nor breaks a user flow Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI PR blocker Critical issues raised during feature testing & need to be fixed before PR is pushed to master QA Needs QA attention Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE Release Table Widget V2 Issues related to Table Widget V2 Widgets Product This label groups issues related to widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [Infinite Scroll] - Post scrolling a few times, the table view breaks

2 participants