Skip to content

Conversation

morzan1001
Copy link

@morzan1001 morzan1001 commented Aug 7, 2025

Description

This pull request fixes a issue with TableWidgetV2 where not all table rows were accessible via scrolling when pagination is disabled.

Problem

When pagination is completely disabled (showPagination: false and serverSidePaginationEnabled: false), the number of rows displayed was incorrectly limited to the visible height of the container. This meant that in a table with, for example, 20 rows, only 5-6 rows could be displayed and scrolled, even though all data had been loaded.

Cause

The getPageSize function in derived.js calculated the pageSize based on the container height, even if paging was not used. This limited the number of rendered rows to the calculated pageSize.

Solution

The logic was adjusted to return the full number of table rows (props.tableData.length) when pagination was disabled. This allows all data to be rendered and scrolled through the table.

Summary by CodeRabbit

  • Bug Fixes
    • Improved table behavior to display all data in a single scrollable view when pagination is fully disabled.
  • Style
    • Cleaned up formatting in multi-line comments for better readability.

@morzan1001 morzan1001 requested a review from a team as a code owner August 7, 2025 15:28
@morzan1001 morzan1001 requested review from rahulbarwal and removed request for a team August 7, 2025 15:28
Copy link
Contributor

coderabbitai bot commented Aug 7, 2025

Walkthrough

A new conditional branch was introduced in the getPageSize method of the TableWidgetV2 to handle scenarios where both pagination and server-side pagination are disabled, ensuring all data is displayed at once. Minor formatting adjustments were also made to comments in the getFilteredTableData method.

Changes

Cohort / File(s) Change Summary
TableWidgetV2 Pagination Logic & Comment Tidy
app/client/src/widgets/TableWidgetV2/widget/derived.js
Added a new condition in getPageSize for non-paginated, non-server-side mode to show all data; minor comment formatting updates in getFilteredTableData.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

When tables scroll and pages hide,
All your data now fits inside.
Pagination off, the rows all show,
With tidy comments in tow.
A simple tweak, a smoother ride—
Let data flow, let widgets glide!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 9acfafd and 4e9098d.

📒 Files selected for processing (1)
  • app/client/src/widgets/TableWidgetV2/widget/derived.js (3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: rahulbarwal
PR: appsmithorg/appsmith#40632
File: app/client/src/widgets/TableWidgetV2/component/VirtualTable/InifiniteScrollBody/useInfiniteScroll.tsx:84-87
Timestamp: 2025-05-12T07:40:10.816Z
Learning: In React Window, visibleStopIndex (often renamed as lastRenderedRowInTheCurrentView in TableWidgetV2) updates as soon as items become partially visible in the viewport. Adding +1 to this index before calculating the current page would incorrectly consider rows not present in the current viewport, potentially causing issues with pagination and infinite scroll logic.
Learnt from: alex-golovanov
PR: appsmithorg/appsmith#33863
File: app/client/src/pages/Editor/DataSourceEditor/DBForm.tsx:93-98
Timestamp: 2024-10-08T15:32:34.115Z
Learning: The suggestion to optimize conditional rendering in `DatasourceDBEditor` is considered out of scope for the current issue related to making text selectable.
Learnt from: alex-golovanov
PR: appsmithorg/appsmith#33863
File: app/client/src/pages/Editor/DataSourceEditor/DBForm.tsx:93-98
Timestamp: 2024-07-26T21:12:57.228Z
Learning: The suggestion to optimize conditional rendering in `DatasourceDBEditor` is considered out of scope for the current issue related to making text selectable.
Learnt from: sumitsum
PR: appsmithorg/appsmith#29875
File: app/server/appsmith-server/src/main/java/com/appsmith/server/services/ConsolidatedAPIServiceImpl.java:0-0
Timestamp: 2024-07-26T21:12:57.228Z
Learning: Test cases for the `getConsolidatedInfoForPageLoad` method have already been added, and the refactoring of the method into smaller methods is planned for later and is being tracked in a separate GitHub issue.
Learnt from: sumitsum
PR: appsmithorg/appsmith#29875
File: app/server/appsmith-server/src/main/java/com/appsmith/server/services/ConsolidatedAPIServiceImpl.java:0-0
Timestamp: 2024-10-08T15:32:34.114Z
Learning: Test cases for the `getConsolidatedInfoForPageLoad` method have already been added, and the refactoring of the method into smaller methods is planned for later and is being tracked in a separate GitHub issue.
Learnt from: rahulbarwal
PR: appsmithorg/appsmith#29375
File: app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/partialExportUtils.ts:0-0
Timestamp: 2024-07-26T21:12:57.228Z
Learning: The user rahulbarwal has updated the code to include null checks or use optional chaining for `canvasWidgets.children` and `customJsLibraries` in the `getAllExportableIds` function as suggested to prevent potential runtime errors.
Learnt from: rahulbarwal
PR: appsmithorg/appsmith#29375
File: app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/partialExportUtils.ts:0-0
Timestamp: 2024-10-08T15:32:34.115Z
Learning: The user rahulbarwal has updated the code to include null checks or use optional chaining for `canvasWidgets.children` and `customJsLibraries` in the `getAllExportableIds` function as suggested to prevent potential runtime errors.
📚 Learning: in react window, visiblestopindex (often renamed as lastrenderedrowinthecurrentview in tablewidgetv2...
Learnt from: rahulbarwal
PR: appsmithorg/appsmith#40632
File: app/client/src/widgets/TableWidgetV2/component/VirtualTable/InifiniteScrollBody/useInfiniteScroll.tsx:84-87
Timestamp: 2025-05-12T07:40:10.816Z
Learning: In React Window, visibleStopIndex (often renamed as lastRenderedRowInTheCurrentView in TableWidgetV2) updates as soon as items become partially visible in the viewport. Adding +1 to this index before calculating the current page would incorrectly consider rows not present in the current viewport, potentially causing issues with pagination and infinite scroll logic.

Applied to files:

  • app/client/src/widgets/TableWidgetV2/widget/derived.js
📚 Learning: test cases for the `getconsolidatedinfoforpageload` method have already been added, and the refactor...
Learnt from: sumitsum
PR: appsmithorg/appsmith#29875
File: app/server/appsmith-server/src/main/java/com/appsmith/server/services/ConsolidatedAPIServiceImpl.java:0-0
Timestamp: 2024-07-26T21:12:57.228Z
Learning: Test cases for the `getConsolidatedInfoForPageLoad` method have already been added, and the refactoring of the method into smaller methods is planned for later and is being tracked in a separate GitHub issue.

Applied to files:

  • app/client/src/widgets/TableWidgetV2/widget/derived.js
📚 Learning: for listwidgetv2, an empty array supplied by users is internally converted to `[{}]` (a placeholder ...
Learnt from: rahulbarwal
PR: appsmithorg/appsmith#40886
File: app/client/src/widgets/ListWidgetV2/MetaWidgetGenerator.ts:1115-1134
Timestamp: 2025-06-13T07:49:21.417Z
Learning: For ListWidgetV2, an empty array supplied by users is internally converted to `[{}]` (a placeholder row) when `pageNo === 1`; this sentinel is never produced by user data, so a singleton empty object on page 1 can be safely treated as “empty list” in MetaWidgetGenerator.

Applied to files:

  • app/client/src/widgets/TableWidgetV2/widget/derived.js
🔇 Additional comments (3)
app/client/src/widgets/TableWidgetV2/widget/derived.js (3)

188-192: LGTM! Fix correctly addresses the pagination disabled scenario.

The conditional logic properly handles the case where both pagination and server-side pagination are disabled, ensuring all table data is rendered for scrolling. The fallback to 100 when tableData is undefined is a reasonable default.


389-392: LGTM! Comment formatting improvement.

Trailing whitespace cleanup improves code consistency.


406-409: LGTM! Comment formatting improvement.

Trailing whitespace cleanup improves code consistency.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 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.
  • 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.

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

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Aug 14, 2025
@morzan1001
Copy link
Author

Hey, before the pull request is closed due to inactivity, I wanted to ask what you think of my change?

@github-actions github-actions bot removed the Stale label Aug 18, 2025
Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Aug 26, 2025
Copy link

github-actions bot commented Sep 2, 2025

This PR has been closed because of inactivity.

@github-actions github-actions bot closed this Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant