Skip to content

Commit

Permalink
fix: significant performance improvement by adding memoization
Browse files Browse the repository at this point in the history
  • Loading branch information
nshenderov committed Oct 4, 2024
1 parent f34fcec commit 16a30ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion admin/src/components/Input/components/GlobalStyling.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const getSystemColorScheme = () =>
? 'dark'
: 'light';

export const GlobalStyling = () => {
const GlobalStyling = () => {
const { theme: userTheme, dontMergeTheme } = globalThis.SH_CKE_CONFIG || {};

const profileTheme = getProfileTheme();
Expand All @@ -29,3 +29,7 @@ export const GlobalStyling = () => {

return <GlobalStyle theme={theme} variant={variant} />;
};

const MemoizedGlobalStyling = React.memo(GlobalStyling);

export { MemoizedGlobalStyling as GlobalStyling };
4 changes: 3 additions & 1 deletion admin/src/components/Input/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@ Input.propTypes = {
placeholder: PropTypes.string,
};

export default Input;
const MemoizedInput = React.memo(Input);

export default MemoizedInput;

0 comments on commit 16a30ff

Please sign in to comment.