Skip to content

Commit c8e5d0c

Browse files
authored
Try removing unitize cache (#35)
1 parent c525a22 commit c8e5d0c

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/unitize.js

+5-15
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,20 @@ let unitlessKeys = {
4545
strokeDashoffset: 1,
4646
strokeMiterlimit: 1,
4747
strokeOpacity: 1,
48-
strokeWidth: 1
48+
strokeWidth: 1,
4949
};
5050

5151
// Taken from https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/dangerousStyleValue.js
52-
export const unitize = (name, value, { cache }) => {
53-
let cachedName = cache[name];
54-
if (!cachedName) {
55-
cachedName = cache[name] = {};
56-
}
57-
58-
const cachedValue = cachedName[value];
59-
if (cachedValue) {
60-
return cachedValue;
61-
}
62-
52+
export const unitize = (name, value) => {
6353
if (value == null || typeof value === "boolean" || value === "") {
64-
return (cachedName[value] = "");
54+
return "";
6555
}
6656

6757
if (typeof value === "number" && value !== 0 && !unitlessKeys[name]) {
68-
return (cachedName[value] = value + "px"); // Presumes implicit 'px' suffix for unitless numbers
58+
return value + "px"; // Presumes implicit 'px' suffix for unitless numbers
6959
}
7060

71-
return (cachedName[value] = String(value).trim());
61+
return String(value).trim();
7262
};
7363

7464
export default unitize;

0 commit comments

Comments
 (0)