Skip to content

fix: reset table page number on infinite scroll reset#40603

Merged
rahulbarwal merged 1 commit intoreleasefrom
rahulbarwal/issue40594/Bug-Infinite-Scroll---Records-are-getting-multiplied-when-select-query-has-limit-and-user-enablesdisables-Infinite-Scroll-toggle
May 7, 2025
Merged

fix: reset table page number on infinite scroll reset#40603
rahulbarwal merged 1 commit intoreleasefrom
rahulbarwal/issue40594/Bug-Infinite-Scroll---Records-are-getting-multiplied-when-select-query-has-limit-and-user-enablesdisables-Infinite-Scroll-toggle

Conversation

@rahulbarwal
Copy link
Contributor

@rahulbarwal rahulbarwal commented May 7, 2025

Description

Problem
Table pagination would not reset properly when infinite scroll was reset, leading to incorrect data display or user being stuck on a non-existent page.

Root cause
The resetTableForInfiniteScroll method did not reset the page number, causing the table to continue from an outdated page index.

Solution
This PR handles resetting the page number to 0 in the resetTableForInfiniteScroll method, ensuring the table starts from the first page during infinite scroll resets for consistent pagination behavior.

Fixes #40594
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/14884926062
Commit: ec11d16
Cypress dashboard.
Tags: @tag.Table
Spec:


Wed, 07 May 2025 14:22:58 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Bug Fixes
    • Resolved an issue where resetting the table with infinite scroll did not return to the first page. Now, the table correctly resets to the first page when infinite scroll is used.

Updated the resetTableForInfiniteScroll method to reset the page number to 0 when the table is reset, ensuring proper pagination behavior during infinite scrolling.
@rahulbarwal rahulbarwal requested a review from a team as a code owner May 7, 2025 13:41
@rahulbarwal rahulbarwal requested review from vivek-appsmith and removed request for a team May 7, 2025 13:41
@rahulbarwal rahulbarwal self-assigned this May 7, 2025
@rahulbarwal rahulbarwal removed the request for review from vivek-appsmith May 7, 2025 13:41
@rahulbarwal rahulbarwal enabled auto-merge (squash) May 7, 2025 13:41
@rahulbarwal rahulbarwal requested a review from AmanAgarwal041 May 7, 2025 13:41
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 7, 2025

Walkthrough

This change updates the resetTableForInfiniteScroll method in the TableWidgetV2 class to call updatePageNumber(0, EventType.ON_NEXT_PAGE) after resetting the widget. This ensures the page number is reset and the relevant event is triggered when infinite scroll is toggled.

Changes

File(s) Change Summary
app/client/src/widgets/TableWidgetV2/widget/index.tsx Modified resetTableForInfiniteScroll to call updatePageNumber(0, EventType.ON_NEXT_PAGE) after widget reset.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TableWidgetV2

    User->>TableWidgetV2: Toggle Infinite Scroll
    activate TableWidgetV2
    TableWidgetV2->>TableWidgetV2: resetTableForInfiniteScroll()
    TableWidgetV2->>TableWidgetV2: resetWidget(widgetId, false)
    TableWidgetV2->>TableWidgetV2: updatePageNumber(0, ON_NEXT_PAGE)
    deactivate TableWidgetV2
Loading

Assessment against linked issues

Objective Addressed Explanation
Prevent record multiplication when toggling Infinite Scroll with select query and limit (#40594)
Ensure page number resets and event triggers correctly on Infinite Scroll toggle (#40594)

Possibly related PRs

Suggested labels

Bug, Table Widget V2, Widgets Product

Suggested reviewers

  • jacquesikot
  • AmanAgarwal041

Poem

When tables scroll with endless grace,
A bug appeared—records out of place!
With a reset and a page set anew,
The rows align, just as they should do.
Now toggle away, let data flow free—
Infinite scroll, as smooth as can be!
🐞➡️✅


📜 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 64944a3 and ec11d16.

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

3067-3070: Good fix for the reset page number issue.

This change ensures that when infinite scroll is reset, the page number is also reset to 0, fixing the issue where users could get stuck on non-existent pages. The update correctly calls updatePageNumber with the appropriate event type after resetting the widget.

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

@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 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 Production 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 7, 2025
@rahulbarwal rahulbarwal added the ok-to-test Required label for CI label May 7, 2025
@rahulbarwal
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

github-actions bot commented May 7, 2025

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

@github-actions
Copy link

github-actions bot commented May 7, 2025

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

@rahulbarwal rahulbarwal merged commit 32fefae into release May 7, 2025
50 checks passed
@rahulbarwal rahulbarwal deleted the rahulbarwal/issue40594/Bug-Infinite-Scroll---Records-are-getting-multiplied-when-select-query-has-limit-and-user-enablesdisables-Infinite-Scroll-toggle branch May 7, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working High This issue blocks a user from building or impacts a lot of users 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 Production 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] - Records are getting multiplied when select query has limit and user enables/disables Infinite Scroll toggle

2 participants