diff --git a/examples/demo/src/reviews/ReviewList.js b/examples/demo/src/reviews/ReviewList.js index 05612e5e68..c88fc3f7c4 100644 --- a/examples/demo/src/reviews/ReviewList.js +++ b/examples/demo/src/reviews/ReviewList.js @@ -1,10 +1,12 @@ import React, { Fragment, Component } from 'react'; +import compose from 'recompose/compose'; +import classnames from 'classnames'; import { BulkDeleteButton, List, Responsive } from 'react-admin'; import { connect } from 'react-redux'; import { push } from 'react-router-redux'; import { Route } from 'react-router'; import Drawer from '@material-ui/core/Drawer'; - +import { createStyles, withStyles } from '@material-ui/core/styles'; import BulkAcceptButton from './BulkAcceptButton'; import BulkRejectButton from './BulkRejectButton'; import ReviewListMobile from './ReviewListMobile'; @@ -20,49 +22,74 @@ const ReviewsBulkActionButtons = props => ( ); +const styles = theme => createStyles({ + root: { + display: 'flex', + }, + list: { + flexGrow: 1, + transition: theme.transitions.create(['all'], { + duration: theme.transitions.duration.enteringScreen, + }), + marginRight: 0, + }, + listWithDrawer: { + marginRight: 400, + }, +}); + class ReviewList extends Component { render() { - const props = this.props; + const { classes, ...props } = this.props; return ( - - } - filters={} - perPage={25} - sort={{ field: 'date', order: 'DESC' }} - > - } - medium={} - /> - +
{({ match }) => { const isMatch = - match && + !!(match && match.params && - match.params.id !== 'create'; + match.params.id !== 'create'); + return ( - - {/* To avoid any errors if the route does not match, we don't render at all the component in this case */} - {isMatch ? ( - + } + filters={} + perPage={25} + sort={{ field: 'date', order: 'DESC' }} + > + } + medium={} /> - ) : null} - + + + {/* To avoid any errors if the route does not match, we don't render at all the component in this case */} + {isMatch ? ( + + ) : null} + + ); }} - +
); } @@ -71,7 +98,7 @@ class ReviewList extends Component { }; } -export default connect( - undefined, - { push } +export default compose( + connect(undefined, { push }), + withStyles(styles) )(ReviewList); diff --git a/packages/ra-core/src/controller/ListController.tsx b/packages/ra-core/src/controller/ListController.tsx index 96b87d008b..c19d5c1bc9 100644 --- a/packages/ra-core/src/controller/ListController.tsx +++ b/packages/ra-core/src/controller/ListController.tsx @@ -94,6 +94,7 @@ interface Props { path?: string; query: ListParams; resource: string; + [key: string]: any; } interface EnhancedProps { changeListParams: Dispatch; @@ -229,6 +230,7 @@ export class UnconnectedListController extends Component< shouldComponentUpdate(nextProps: Props & EnhancedProps, nextState) { if ( + nextProps.className === this.props.className && nextProps.translate === this.props.translate && nextProps.isLoading === this.props.isLoading && nextProps.version === this.props.version &&