Skip to content

Commit 6a8c7fb

Browse files
authored
Add defensive checks for cases where maxHeight is empty string (#482)
* Fix assertion error when maxHeight is empty string When getComputedStyle().maxHeight returns an empty string (which can happen during DOM transitions, animations, or certain CSS edge cases), the existing check `maxHeightStyle !== 'none'` passes, but the subsequent call to estimateElementHeight() fails its assertion because empty string is falsy. Add a truthiness check to prevent calling estimateElementHeight() with an empty or falsy maxHeight value. Fixes assertion: "You called estimateElementHeight without a fallbackHeight" * fix: add defensive check for error: Uncaught Error: Assertion Failed: You called estimateElement height without a fallbackHeight at assert$1 (assert.js:40:13) at estimateElementHeight (estimate-element-height.js:3:3) at StaticRadar._updateConstants (radar.js:340:36) at StaticRadar.update (radar.js:222:10) at radar.js:214:12 at Array.execJob (index.js:30:7) at Scheduler.flush (index.js:92:11) at index.js:78:12 at sentryWrapped (helpers.js:117:17)
1 parent 1846c99 commit 6a8c7fb

File tree

1 file changed

+2
-2
lines changed
  • vertical-collection/addon/-private/data-view/radar

1 file changed

+2
-2
lines changed

vertical-collection/addon/-private/data-view/radar/radar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ export default class Radar {
410410
const maxHeightStyle =
411411
window.getComputedStyle(_scrollContainer).maxHeight;
412412

413-
if (maxHeightStyle !== 'none') {
413+
if (maxHeightStyle && maxHeightStyle !== 'none') {
414414
scrollContainerMaxHeight = estimateElementHeight(
415415
_scrollContainer.parentElement,
416416
maxHeightStyle,
@@ -419,7 +419,7 @@ export default class Radar {
419419
}
420420

421421
const calculatedEstimateHeight =
422-
typeof estimateHeight === 'string'
422+
typeof estimateHeight === 'string' && estimateHeight
423423
? estimateElementHeight(_itemContainer, estimateHeight)
424424
: estimateHeight;
425425

0 commit comments

Comments
 (0)