@hsds/utils-react
Advanced tools
Comparing version 7.1.2 to 7.1.3
@@ -5,2 +5,9 @@ # Changelog | ||
### [7.1.3](https://github.com/helpscout/hsds/compare/utils-react-7.1.2...utils-react-7.1.3) (2023-08-31) | ||
### Bug Fixes | ||
* **utils-react:** checks type on children in getComponentName ([184521d](https://github.com/helpscout/hsds/commit/184521d98ac440915bad610360eea612e4facecf)) | ||
### [7.1.2](https://github.com/helpscout/hsds/compare/utils-react-7.1.1...utils-react-7.1.2) (2023-08-07) | ||
@@ -7,0 +14,0 @@ |
{ | ||
"name": "@hsds/utils-react", | ||
"version": "7.1.2", | ||
"version": "7.1.3", | ||
"peerDependencies": { | ||
@@ -11,5 +11,5 @@ "react": "~16.14.0 || ~17.0.2" | ||
"dependencies": { | ||
"lodash.get": "4.4.2", | ||
"lodash.isplainobject": "4.0.6" | ||
"lodash.get": "^4.4.2", | ||
"lodash.isplainobject": "^4.0.6" | ||
} | ||
} |
@@ -52,3 +52,6 @@ "use strict"; | ||
if (!isReactComponent(Component)) return ''; | ||
return (0, _lodash.default)(Component, 'displayName') || (0, _lodash.default)(Component, 'name') || 'Component'; | ||
return (0, _lodash.default)(Component, 'displayName') || (0, _lodash.default)(Component, 'name') || | ||
// need to also check the type.displayName and type.name | ||
// when checking component children | ||
(0, _lodash.default)(Component, 'type.displayName') || (0, _lodash.default)(Component, 'type.name') || 'Component'; | ||
} | ||
@@ -55,0 +58,0 @@ /** |
@@ -29,3 +29,1 @@ # react | ||
Run `nx test react` to execute the unit tests via [Jest](https://jestjs.io). | ||
> Up to date with hsds-react `v3.54.11` |
@@ -47,3 +47,11 @@ /* eslint-disable no-misleading-character-class */ | ||
if (!isReactComponent(Component)) return '' | ||
return get(Component, 'displayName') || get(Component, 'name') || 'Component' | ||
return ( | ||
get(Component, 'displayName') || | ||
get(Component, 'name') || | ||
// need to also check the type.displayName and type.name | ||
// when checking component children | ||
get(Component, 'type.displayName') || | ||
get(Component, 'type.name') || | ||
'Component' | ||
) | ||
} | ||
@@ -50,0 +58,0 @@ /** |
29641
461
29
Updatedlodash.get@^4.4.2
Updatedlodash.isplainobject@^4.0.6