fix: remove object-hash dependency from home plugin

The object hash doesn't work if the component props include React
components such as icons. This is true for example the HomepageToolkit
component. Removed the hashing of the component props
completely as the hash is totally optional to be used as a key in the
CustomHomepageGrid.

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2023-05-08 08:41:22 +03:00
parent d1797f0e91
commit acca896646
5 changed files with 36 additions and 6 deletions
-1
View File
@@ -48,7 +48,6 @@
"@rjsf/validator-ajv8": "5.6.0",
"@types/react": "^16.13.1 || ^17.0.0",
"lodash": "^4.17.21",
"object-hash": "^3.0.0",
"react-grid-layout": "^1.3.4",
"react-resizable": "^3.0.4",
"react-use": "^17.2.4",
@@ -46,7 +46,6 @@ import { CardConfig } from '../../extensions';
// eslint-disable-next-line new-cap
const ResponsiveGrid = WidthProvider(Responsive);
const hash = require('object-hash');
const useStyles = makeStyles((theme: Theme) =>
createStyles({
@@ -336,14 +335,14 @@ export const CustomHomepageGrid = (props: CustomHomepageGridProps) => {
...widget.component.props,
...(w.settings ?? {}),
};
const propsHash = hash(widgetProps, {});
return (
<div
key={l.i}
className={`${styles.widgetWrapper} ${editMode && 'edit'}`}
>
<ErrorBoundary>
<widget.component.type key={propsHash} {...widgetProps} />
<widget.component.type {...widgetProps} />
</ErrorBoundary>
{editMode && (
<WidgetSettingsOverlay