stylable-components
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -132,3 +132,4 @@ "use strict"; | ||
const cache = (0, react_1.useRef)(new Map()); | ||
const [sizes, updateSizes] = (0, react_1.useState)(() => getSizes(ref, data, precomputed, getId, false, cache.current)); | ||
const calculatedSize = (0, react_1.useMemo)(() => getSizes(ref, data, precomputed, getId, false, cache.current), [data, getId, precomputed, ref]); | ||
const [sizes, updateSizes] = (0, react_1.useState)(() => calculatedSize); | ||
const delayedUpdateSizes = (0, use_delayed_update_1.useDelayedUpdateState)(updateSizes); | ||
@@ -180,2 +181,5 @@ const { observer, listen } = (0, react_1.useMemo)(createSetableObserver, []); | ||
}, [data, precomputed, getId, shouldMeasure, size, ref, shouldWatchSize, observer]); | ||
if (!shouldMeasure) { | ||
return calculatedSize; | ||
} | ||
return sizes; | ||
@@ -182,0 +186,0 @@ } |
@@ -168,2 +168,7 @@ "use strict"; | ||
} | ||
const overlayStyle = { | ||
...innerStyle, | ||
width: '100%', | ||
height: '100%', | ||
}; | ||
const listRootWithStyle = (0, exports.forwardListRoot)(listRoot || use_element_slot_1.defaultRoot, { | ||
@@ -177,2 +182,3 @@ style: innerStyle, | ||
} }, | ||
react_1.default.createElement(list_1.List, { getId: getId, ItemRenderer: ItemRenderer, listRoot: listRootWithStyle, items: rendereredItems, focusControl: [focused, setFocused], selectionControl: [selected, setSelected], transmitKeyPress: transmitKeyPress }), | ||
overlay ? (react_1.default.createElement(exports.ListOverlaySlot, { slot: overlay, props: { | ||
@@ -182,5 +188,4 @@ itemSizes, | ||
avgSize, | ||
style: innerStyle, | ||
style: overlayStyle, | ||
} })) : null, | ||
react_1.default.createElement(list_1.List, { getId: getId, ItemRenderer: ItemRenderer, listRoot: listRootWithStyle, items: rendereredItems, focusControl: [focused, setFocused], selectionControl: [selected, setSelected], transmitKeyPress: transmitKeyPress }), | ||
react_1.default.createElement("div", { style: { | ||
@@ -187,0 +192,0 @@ height: maxScrollSize + 'px', |
{ | ||
"name": "stylable-components", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "React components that use Stylable.", | ||
@@ -27,3 +27,4 @@ "main": "dist/index.js", | ||
"access": "public" | ||
} | ||
}, | ||
"gitHead": "20118a38135fd111c6d680c08db656c06f25adda" | ||
} |
@@ -150,3 +150,7 @@ import type React from 'react'; | ||
const cache = useRef(new Map<string, WatchedSize>()); | ||
const [sizes, updateSizes] = useState(() => getSizes(ref, data, precomputed, getId, false, cache.current)); | ||
const calculatedSize = useMemo( | ||
() => getSizes(ref, data, precomputed, getId, false, cache.current), | ||
[data, getId, precomputed, ref] | ||
); | ||
const [sizes, updateSizes] = useState(() => calculatedSize); | ||
const delayedUpdateSizes = useDelayedUpdateState(updateSizes); | ||
@@ -199,2 +203,5 @@ const { observer, listen } = useMemo(createSetableObserver, []); | ||
}, [data, precomputed, getId, shouldMeasure, size, ref, shouldWatchSize, observer]); | ||
if (!shouldMeasure) { | ||
return calculatedSize; | ||
} | ||
return sizes; | ||
@@ -201,0 +208,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1122994
15674