Skip to content

fix: simplify table reset logic in TableWidgetV2#40486

Merged
rahulbarwal merged 1 commit intoreleasefrom
rahulbarwal/issue40452/Bug-The-order-of-the-table-data-changes-when-we-enable-infinte-scroll
Apr 30, 2025
Merged

fix: simplify table reset logic in TableWidgetV2#40486
rahulbarwal merged 1 commit intoreleasefrom
rahulbarwal/issue40452/Bug-The-order-of-the-table-data-changes-when-we-enable-infinte-scroll

Conversation

@rahulbarwal
Copy link
Contributor

@rahulbarwal rahulbarwal commented Apr 30, 2025

Description

Problem

The table state wasn't being reset automatically, causing issues with individual page numbers and data properties.

Root cause

Using manual page number handling led to unexpected outcomes due to not having an automatic reset mechanism for the table state when infinite scroll was enabled or disabled.

Solution
To mitigate this issue, we have utilized in-built evaluations and the reset widget method to properly reset the widget.

Fixes: #40452

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14747978041
Commit: 32f17cc
Cypress dashboard.
Tags: @tag.Widget
Spec:


Wed, 30 Apr 2025 07:28:01 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Refactor
    • Simplified the table reset process for infinite scroll by streamlining internal logic, resulting in a more efficient reset experience for users. No visible changes to the interface or features.

@rahulbarwal rahulbarwal requested a review from a team as a code owner April 30, 2025 06:09
@rahulbarwal rahulbarwal requested review from AmanAgarwal041 and jacquesikot and removed request for a team April 30, 2025 06:09
@rahulbarwal rahulbarwal enabled auto-merge (squash) April 30, 2025 06:09
@rahulbarwal rahulbarwal self-assigned this Apr 30, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 30, 2025

Walkthrough

This change updates the resetTableForInfiniteScroll method in the TableWidgetV2 widget. The previous implementation, which manually reset various meta properties related to infinite scroll, has been replaced. The new approach delegates the reset logic to an external resetWidget function, simplifying the method. An import statement for resetWidget is also added.

Changes

File(s) Change Summary
app/client/src/widgets/TableWidgetV2/widget/index.tsx Replaced manual reset logic in resetTableForInfiniteScroll with a call to resetWidget; added import for resetWidget.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TableWidgetV2
    participant resetWidget

    User->>TableWidgetV2: Calls resetTableForInfiniteScroll()
    TableWidgetV2->>resetWidget: Invokes resetWidget(widgetId, false)
    resetWidget-->>TableWidgetV2: Completes reset
Loading

Possibly related PRs

Suggested labels

Enhancement, Widgets Product, Table Widget V2, Task, ok-to-test

Suggested reviewers

  • ApekshaBhosale
  • jacquesikot

Poem

When infinite scroll needs a reset,
Simplicity is what we now get.
No more manual tweaks in sight,
One function call sets things right.
TableWidgetV2, you’re lean and neat—
Refactored code is hard to beat!
🚀✨


📜 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 557ee05 and 32f17cc.

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

143-143: Good addition of the resetWidget import.

This import brings in the function needed for the refactored reset logic implementation.


3067-3069: Excellent refactoring to simplify table reset logic.

The implementation has been greatly simplified by leveraging the external resetWidget function rather than manually handling the reset of multiple meta properties. This change addresses the root issue where table state wasn't resetting automatically when infinite scroll was toggled on/off.

This refactoring:

  • Reduces code complexity
  • Ensures consistent reset behavior
  • Delegates responsibility to a specialized function
  • Makes the code more maintainable
✨ 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.

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 added the ok-to-test Required label for CI label Apr 30, 2025
@github-actions github-actions bot removed the ok-to-test Required label for CI label Apr 30, 2025
@rahulbarwal rahulbarwal changed the title refactor: simplify table reset logic in TableWidgetV2 fix: simplify table reset logic in TableWidgetV2 Apr 30, 2025
@rahulbarwal
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions github-actions bot added the Bug Something isn't working label Apr 30, 2025
@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/14747924735.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 40486.
recreate: .

@github-actions github-actions bot added Needs Triaging Needs attention from maintainers to triage PR blocker Critical issues raised during feature testing & need to be fixed before PR is pushed to master 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 Apr 30, 2025
@rahulbarwal rahulbarwal added the ok-to-test Required label for CI label Apr 30, 2025
@github-actions
Copy link

Deploy-Preview-URL: https://ce-40486.dp.appsmith.com

@rahulbarwal rahulbarwal merged commit eb89992 into release Apr 30, 2025
57 checks passed
@rahulbarwal rahulbarwal deleted the rahulbarwal/issue40452/Bug-The-order-of-the-table-data-changes-when-we-enable-infinte-scroll branch April 30, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working 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 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]: The order of the table data changes when we enable infinte scroll

2 participants