From 16a30ff5f484ba1e701d163808ff5beeeff70d40 Mon Sep 17 00:00:00 2001 From: nshenderov Date: Fri, 4 Oct 2024 15:59:39 +0300 Subject: [PATCH] fix: significant performance improvement by adding memoization --- admin/src/components/Input/components/GlobalStyling.jsx | 6 +++++- admin/src/components/Input/index.jsx | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/admin/src/components/Input/components/GlobalStyling.jsx b/admin/src/components/Input/components/GlobalStyling.jsx index 790081f..fac321f 100644 --- a/admin/src/components/Input/components/GlobalStyling.jsx +++ b/admin/src/components/Input/components/GlobalStyling.jsx @@ -15,7 +15,7 @@ const getSystemColorScheme = () => ? 'dark' : 'light'; -export const GlobalStyling = () => { +const GlobalStyling = () => { const { theme: userTheme, dontMergeTheme } = globalThis.SH_CKE_CONFIG || {}; const profileTheme = getProfileTheme(); @@ -29,3 +29,7 @@ export const GlobalStyling = () => { return ; }; + +const MemoizedGlobalStyling = React.memo(GlobalStyling); + +export { MemoizedGlobalStyling as GlobalStyling }; diff --git a/admin/src/components/Input/index.jsx b/admin/src/components/Input/index.jsx index 61c324b..85e545b 100644 --- a/admin/src/components/Input/index.jsx +++ b/admin/src/components/Input/index.jsx @@ -56,4 +56,6 @@ Input.propTypes = { placeholder: PropTypes.string, }; -export default Input; +const MemoizedInput = React.memo(Input); + +export default MemoizedInput; \ No newline at end of file