Skip to content

Commit

Permalink
Merge pull request #5434 from marmelab/fix-spinner-flickering
Browse files Browse the repository at this point in the history
Fix Appbar custom content flickers when loading
  • Loading branch information
djhi authored Oct 23, 2020
2 parents 8fdff88 + a87bb03 commit 2a03f18
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/ra-ui-materialui/src/layout/LoadingIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { useSelector } from 'react-redux';
import { makeStyles } from '@material-ui/core/styles';
import { makeStyles, useTheme } from '@material-ui/core/styles';
import CircularProgress from '@material-ui/core/CircularProgress';
import { useRefreshWhenVisible } from 'ra-core';

import RefreshIconButton from '../button/RefreshIconButton';

const useStyles = makeStyles(
{
theme => ({
loader: {
margin: 14,
margin: theme.spacing(2),
},
loadedIcon: {},
},
}),
{ name: 'RaLoadingIndicator' }
);

Expand All @@ -23,12 +23,13 @@ const LoadingIndicator = props => {
useRefreshWhenVisible();
const loading = useSelector(state => state.admin.loading > 0);
const classes = useStyles(props);
const theme = useTheme();
return loading ? (
<CircularProgress
className={classNames('app-loader', classes.loader, className)}
color="inherit"
size={18}
thickness={5}
size={theme.spacing(2)}
thickness={6}
{...rest}
/>
) : (
Expand Down

0 comments on commit 2a03f18

Please sign in to comment.