Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Inputs layout is broken when rendering the Login page first #8368

Merged
merged 1 commit into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/ra-ui-materialui/src/AdminUI.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as React from 'react';
import { createElement, ComponentType } from 'react';
import { CoreAdminUI, CoreAdminUIProps } from 'ra-core';
import { ScopedCssBaseline } from '@mui/material';

import {
Layout as DefaultLayout,
LoadingPage,
Expand All @@ -10,10 +12,10 @@ import {
import { Login } from './auth';

export const AdminUI = ({ notification, ...props }: AdminUIProps) => (
<>
<ScopedCssBaseline enableColorScheme>
<CoreAdminUI {...props} />
{createElement(notification)}
</>
</ScopedCssBaseline>
);

export interface AdminUIProps extends CoreAdminUIProps {
Expand Down
63 changes: 27 additions & 36 deletions packages/ra-ui-materialui/src/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import React, {
} from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import clsx from 'clsx';
import { ScopedCssBaseline } from '@mui/material';
import { styled, SxProps } from '@mui/material/styles';
import { CoreLayoutProps } from 'ra-core';

Expand Down Expand Up @@ -40,42 +39,34 @@ export const Layout = (props: LayoutProps) => {
};

return (
<ScopedCssBaseline enableColorScheme>
<StyledLayout className={clsx('layout', className)} {...rest}>
<SkipNavigationButton />
<div className={LayoutClasses.appFrame}>
<AppBar open={open} title={title} />
<main className={LayoutClasses.contentWithSidebar}>
<Sidebar>
<Menu hasDashboard={!!dashboard} />
</Sidebar>
<div
id="main-content"
className={LayoutClasses.content}
<StyledLayout className={clsx('layout', className)} {...rest}>
<SkipNavigationButton />
<div className={LayoutClasses.appFrame}>
<AppBar open={open} title={title} />
<main className={LayoutClasses.contentWithSidebar}>
<Sidebar>
<Menu hasDashboard={!!dashboard} />
</Sidebar>
<div id="main-content" className={LayoutClasses.content}>
<ErrorBoundary
onError={handleError}
fallbackRender={({ error, resetErrorBoundary }) => (
<Error
error={error}
errorComponent={errorComponent}
errorInfo={errorInfo}
resetErrorBoundary={resetErrorBoundary}
title={title}
/>
)}
>
<ErrorBoundary
onError={handleError}
fallbackRender={({
error,
resetErrorBoundary,
}) => (
<Error
error={error}
errorComponent={errorComponent}
errorInfo={errorInfo}
resetErrorBoundary={resetErrorBoundary}
title={title}
/>
)}
>
{children}
</ErrorBoundary>
</div>
</main>
<Inspector />
</div>
</StyledLayout>
</ScopedCssBaseline>
{children}
</ErrorBoundary>
</div>
</main>
<Inspector />
</div>
</StyledLayout>
);
};

Expand Down