Skip to content

Conversation

@gimmyhehe
Copy link
Member

@gimmyhehe gimmyhehe commented Sep 28, 2025

PR

修复切换分页大小后,表格高度不正确问题

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Table now exposes live container scroll width and height values, enabling visibility into horizontal and vertical scroll dimensions.
  • Style

    • Minor formatting cleanup in the grid body component (no behavioral changes).

@coderabbitai
Copy link

coderabbitai bot commented Sep 28, 2025

Walkthrough

Added two reactive refs for container scroll dimensions to the Vue table component and exposed them via setup return. Performed a minor whitespace cleanup in the grid body component. No changes to function signatures; only public reactive data additions in the table.

Changes

Cohort / File(s) Summary
Table scroll metrics exposure
packages/vue/src/grid/src/table/src/table.ts
Added containerScrollWidth and containerScrollHeight as reactive refs (initialized to 0) and exposed them via setup return for external consumption.
Formatting cleanup
packages/vue/src/grid/src/body/src/body.tsx
Removed a stray blank line before a return in render; no logic changes.

Sequence Diagram(s)

sequenceDiagram
  actor Dev as Consumer
  participant Table as Table Component
  participant State as Reactive State

  Dev->>Table: Mount/use component
  Note right of Table: Setup initializes<br/>containerScrollWidth = 0<br/>containerScrollHeight = 0
  Table->>State: Create refs for scroll metrics
  Table-->>Dev: Expose { containerScrollWidth, containerScrollHeight }
  Note over Dev,Table: Consumers can read/react to scroll dimensions
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nudge the grid with whiskered grace,
Two scroll stats now take their place—
Width and height, reactive bright,
Guiding hops by pixel light.
One spare line swept out of sight,
Carrot-commits done just right. 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The provided title claims to “fix body height error after change pager size,” but the actual changes only add reactive references for container scroll dimensions and remove a blank line without altering any body height logic. As a result, the title does not accurately summarize the main content of the changeset. Please update the title to reflect the actual changes—such as exposing containerScrollWidth and containerScrollHeight—or implement the intended body height correction before merging.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cgm/fix-grid-containerHeight

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the bug Something isn't working label Sep 28, 2025
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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bce2431 and 2305c65.

📒 Files selected for processing (2)
  • packages/vue/src/grid/src/body/src/body.tsx (0 hunks)
  • packages/vue/src/grid/src/table/src/table.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • packages/vue/src/grid/src/body/src/body.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
packages/vue/src/grid/src/table/src/table.ts (1)
packages/vue-common/src/index.ts (1)
  • hooks (453-453)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)

Comment on lines +662 to +665
// 表格滚动宽度
const containerScrollWidth = hooks.ref(0)
// 表格滚动高度
const containerScrollHeight = hooks.ref(0)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Populate the new scroll refs or the pager-height bug will persist.

containerScrollWidth / containerScrollHeight are introduced here but never assigned anywhere else in the module, so they remain stuck at 0. Without wiring them into the code that measures the body wrapper (e.g., the resize handlers / GridBody scroll listeners), nothing downstream can react to the real scroll dimensions, meaning the table height issue after changing page size is still unfixed. Please make sure these refs are updated when the container mounts and whenever its scroll size changes.

🤖 Prompt for AI Agents
packages/vue/src/grid/src/table/src/table.ts around lines 662 to 665: the newly
added refs containerScrollWidth and containerScrollHeight are never updated,
leaving them at 0 and causing the pager-height bug; update these refs when the
container mounts and whenever its scroll size changes by wiring them into the
container mount logic and existing resize/scroll handlers (or add listeners on
GridBody): read element.scrollWidth and element.scrollHeight (using nextTick if
needed) and assign to the refs, ensure handlers run on mount and on
resize/scroll events, and unregister listeners on unmount.

@zzcr zzcr merged commit b835a3c into dev Sep 30, 2025
10 of 11 checks passed
@zzcr zzcr deleted the cgm/fix-grid-containerHeight branch September 30, 2025 02:46
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.

3 participants