Skip to content

Commit

Permalink
Merge pull request #6264 from WiXSL/fix-layout-render
Browse files Browse the repository at this point in the history
Fix Layout calls Material-UI's createMuiTheme on every render
  • Loading branch information
fzaninotto authored May 10, 2021
2 parents e23e30f + a08c8f0 commit 36bdd6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ const Layout = ({
...props
}: LayoutProps): JSX.Element => {
const themeProp = useRef(themeOverride);
const [theme, setTheme] = useState(createMuiTheme(themeOverride));
const [theme, setTheme] = useState(() => createMuiTheme(themeOverride));

useEffect(() => {
if (themeProp.current !== themeOverride) {
Expand Down

0 comments on commit 36bdd6b

Please sign in to comment.