carbon-react 138.1.1 → 138.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -118,7 +118,14 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
const
|
|
121
|
+
const totalSize = virtualizer.getTotalSize();
|
|
122
|
+
// virtualizer.getTotalSize() returns the total size in pixels for the virtualized items. If nothing is loaded,
|
|
123
|
+
// then the list height is set to 0 (line 21 of src/components/select/select-list/select-list.style.ts) as
|
|
124
|
+
// the method always returns a number and never undefined, it seems.
|
|
125
|
+
// https://github.com/TanStack/virtual/commit/e43e03e500588b2da36f184ecaba2b8e5a506596 suggests that items are
|
|
126
|
+
// never returned regardless if the container height it 0, so the below line ensures that a container of at
|
|
127
|
+
// least 1px is always available to render into.
|
|
128
|
+
const listHeight = totalSize === 0 ? 1 : totalSize;
|
|
122
129
|
useEffect(() => {
|
|
123
130
|
if (isOpen) {
|
|
124
131
|
blockScroll();
|
|
@@ -127,7 +127,14 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
const
|
|
130
|
+
const totalSize = virtualizer.getTotalSize();
|
|
131
|
+
// virtualizer.getTotalSize() returns the total size in pixels for the virtualized items. If nothing is loaded,
|
|
132
|
+
// then the list height is set to 0 (line 21 of src/components/select/select-list/select-list.style.ts) as
|
|
133
|
+
// the method always returns a number and never undefined, it seems.
|
|
134
|
+
// https://github.com/TanStack/virtual/commit/e43e03e500588b2da36f184ecaba2b8e5a506596 suggests that items are
|
|
135
|
+
// never returned regardless if the container height it 0, so the below line ensures that a container of at
|
|
136
|
+
// least 1px is always available to render into.
|
|
137
|
+
const listHeight = totalSize === 0 ? 1 : totalSize;
|
|
131
138
|
(0, _react.useEffect)(() => {
|
|
132
139
|
if (isOpen) {
|
|
133
140
|
blockScroll();
|