🐛 fix(genericIconComponent): wrap ForwardedIconComponent with memo to improve performance by preventing unnecessary re-renders
🔨 refactor(genericIconComponent): improve code readability by adding line breaks and indentation for better code organization and readability
This commit is contained in:
parent
c863621987
commit
07e1d2a459
1 changed files with 43 additions and 41 deletions
|
|
@ -1,9 +1,10 @@
|
||||||
import dynamicIconImports from "lucide-react/dynamicIconImports";
|
import dynamicIconImports from "lucide-react/dynamicIconImports";
|
||||||
import { Suspense, forwardRef, lazy } from "react";
|
import { Suspense, forwardRef, lazy, memo } from "react";
|
||||||
import { IconComponentProps } from "../../types/components";
|
import { IconComponentProps } from "../../types/components";
|
||||||
import { nodeIconsLucide } from "../../utils/styleUtils";
|
import { nodeIconsLucide } from "../../utils/styleUtils";
|
||||||
|
|
||||||
const ForwardedIconComponent = forwardRef(
|
const ForwardedIconComponent = memo(
|
||||||
|
forwardRef(
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
|
|
@ -46,6 +47,7 @@ const ForwardedIconComponent = forwardRef(
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
export default ForwardedIconComponent;
|
export default ForwardedIconComponent;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue