refactor: default noSsr to true in useMediaQuery
This commit is contained in:
@@ -29,9 +29,7 @@ export default function AppBar(props: AppBarProps): React.ReactElement {
|
||||
const { drawerOpen, onDrawerOpen, onDrawerClose, maxWidth = false } = props;
|
||||
|
||||
const theme = useTheme();
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), {
|
||||
noSsr: true,
|
||||
});
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'));
|
||||
|
||||
const [accountMenuAnchorElement, setAccountMenuAnchorElement] =
|
||||
React.useState<null | HTMLElement>(null);
|
||||
|
@@ -10,9 +10,7 @@ import { IconButton } from './style';
|
||||
export default function ConditionalIconButton(props: any): React.ReactElement {
|
||||
const { icon, ...buttonProps } = props;
|
||||
const theme = useTheme();
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), {
|
||||
noSsr: true,
|
||||
});
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'));
|
||||
|
||||
if (matchSmallScreens) {
|
||||
return (
|
||||
|
@@ -31,9 +31,7 @@ type DrawerProps = {
|
||||
export default function Drawer(props: DrawerProps): React.ReactElement {
|
||||
const { links = [], bottomLinks = [], ...drawerProps } = props;
|
||||
const theme = useTheme();
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), {
|
||||
noSsr: true,
|
||||
});
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'));
|
||||
const formatMessage = useFormatMessage();
|
||||
|
||||
const closeOnClick = (event: React.SyntheticEvent) => {
|
||||
|
@@ -52,9 +52,7 @@ export default function PublicLayout({
|
||||
}: PublicLayoutProps): React.ReactElement {
|
||||
const version = useVersion();
|
||||
const theme = useTheme();
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg'), {
|
||||
noSsr: true,
|
||||
});
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg'));
|
||||
const [isDrawerOpen, setDrawerOpen] = React.useState(!matchSmallScreens);
|
||||
|
||||
const openDrawer = () => setDrawerOpen(true);
|
||||
|
@@ -49,9 +49,7 @@ export default function SettingsLayout({
|
||||
}: SettingsLayoutProps): React.ReactElement {
|
||||
const { isCloud } = useAutomatischInfo();
|
||||
const theme = useTheme();
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg'), {
|
||||
noSsr: true,
|
||||
});
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg'));
|
||||
const [isDrawerOpen, setDrawerOpen] = React.useState(!matchSmallScreens);
|
||||
|
||||
const openDrawer = () => setDrawerOpen(true);
|
||||
|
@@ -51,9 +51,7 @@ const ReconnectConnection = (props: any): React.ReactElement => {
|
||||
|
||||
export default function Application(): React.ReactElement | null {
|
||||
const theme = useTheme();
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), {
|
||||
noSsr: true,
|
||||
});
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'));
|
||||
const formatMessage = useFormatMessage();
|
||||
const connectionsPathMatch = useMatch({
|
||||
path: URLS.APP_CONNECTIONS_PATTERN,
|
||||
|
@@ -251,6 +251,11 @@ const extendedTheme = createTheme({
|
||||
}),
|
||||
},
|
||||
},
|
||||
MuiUseMediaQuery: {
|
||||
defaultProps: {
|
||||
noSsr: true,
|
||||
},
|
||||
},
|
||||
MuiTab: {
|
||||
styleOverrides: {
|
||||
root: ({ theme }) => ({
|
||||
|
Reference in New Issue
Block a user