feat: add clientWidth/clientHeight for createElementSize#804
Conversation
🦋 Changeset detectedLatest commit: 636b436 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ffc6e7e to
0617514
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR extends the ChangesClient dimensions support
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@ylc395 I'd love to merge this. Can you add a changeset? Also I've migrated your changes to the new 2.0 release we're planning. If I don't hear back I'll close this out though which would be a shame. |
|
Changeset added |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.changeset/dull-colts-sip.md (1)
5-5: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueFix casing to match actual field names.
The added properties are
clientWidth/clientHeight, notClientWidth/ClientHeight.✏️ Proposed fix
-Add `ClientHeight` and `ClientWidth` for element size +Add `clientHeight` and `clientWidth` for element size🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.changeset/dull-colts-sip.md at line 5, The changeset entry uses the wrong property casing for the element size fields. Update the note in the changeset so it matches the actual names used by the related API, `clientWidth` and `clientHeight`, and make sure the wording in the changeset aligns with those symbols rather than `ClientWidth`/`ClientHeight`.packages/resize-observer/src/index.ts (1)
156-163: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider updating
server.test.tsfor parity.The existing server-side test only asserts Unit test verifies createElementSize returns width/height as null when the element getter returns false. It doesn't cover the new
clientWidth/clientHeightnull fallback fields introduced here. SinceELEMENT_SIZE_FALLBACKnow includes these fields, extending that test would keep coverage consistent with the updatedNullableSizecontract.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/resize-observer/src/index.ts` around lines 156 - 163, Update the server-side parity test to cover the expanded NullableSize shape in getElementSize. In server.test.ts, extend the existing createElementSize/getElementSize fallback assertion so it also verifies clientWidth and clientHeight are null when the target is false or unavailable, matching ELEMENT_SIZE_FALLBACK and the updated NullableSize contract.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.changeset/dull-colts-sip.md:
- Line 5: The changeset entry uses the wrong property casing for the element
size fields. Update the note in the changeset so it matches the actual names
used by the related API, `clientWidth` and `clientHeight`, and make sure the
wording in the changeset aligns with those symbols rather than
`ClientWidth`/`ClientHeight`.
In `@packages/resize-observer/src/index.ts`:
- Around line 156-163: Update the server-side parity test to cover the expanded
NullableSize shape in getElementSize. In server.test.ts, extend the existing
createElementSize/getElementSize fallback assertion so it also verifies
clientWidth and clientHeight are null when the target is false or unavailable,
matching ELEMENT_SIZE_FALLBACK and the updated NullableSize contract.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4aa31849-90b3-4fc8-a1fb-34c566990221
📒 Files selected for processing (3)
.changeset/dull-colts-sip.mdpackages/resize-observer/src/index.tspackages/resize-observer/test/index.test.ts
e87ecf8 to
636b436
Compare
add extra clientWidth/clientHeight for
createElementSize.If this proposal is acceptable, we can keep on going, otherwise just close PR.
Summary by CodeRabbit
clientWidthandclientHeightalongsidewidthandheight.width,height,clientWidth, andclientHeightasnull.