From 2fe2470b3a0c1479f2db7a98657ff20fcf8ed9ca Mon Sep 17 00:00:00 2001 From: meriadec Date: Mon, 2 Jul 2018 11:55:46 +0200 Subject: [PATCH] Remove component This reduce amount of blinks - but not prevent them completely in dev So still need investigate --- src/components/OperationsList/index.js | 104 ++++++++++++------------- src/components/base/Defer.js | 40 ---------- src/components/base/Modal/index.js | 3 +- 3 files changed, 50 insertions(+), 97 deletions(-) delete mode 100644 src/components/base/Defer.js diff --git a/src/components/OperationsList/index.js b/src/components/OperationsList/index.js index 5f177c89..4e3678d3 100644 --- a/src/components/OperationsList/index.js +++ b/src/components/OperationsList/index.js @@ -24,7 +24,6 @@ import IconAngleDown from 'icons/AngleDown' import Box, { Card } from 'components/base/Box' import Text from 'components/base/Text' -import Defer from 'components/base/Defer' import Track from 'analytics/Track' import SectionTitle from './SectionTitle' @@ -100,61 +99,56 @@ export class OperationsList extends PureComponent { const accountsMap = accounts ? keyBy(accounts, 'id') : { [account.id]: account } return ( - - - {title && ( - - {title} + + {title && ( + + {title} + + )} + {groupedOperations.sections.map(group => ( + + + + {group.data.map(operation => { + const account = accountsMap[operation.accountId] + if (!account) { + return null + } + return ( + + ) + })} + + + ))} + {groupedOperations.completed ? ( + sum + s.data.length, 0)} + /> + ) : null} + {!groupedOperations.completed ? ( + + {t('app:common.showMore')} + + + ) : ( + + + {t('app:operationList.noMoreOperations')} - )} - {groupedOperations.sections.map(group => ( - - - - {group.data.map(operation => { - const account = accountsMap[operation.accountId] - if (!account) { - return null - } - return ( - - ) - })} - - - ))} - {groupedOperations.completed ? ( - sum + s.data.length, - 0, - )} - /> - ) : null} - {!groupedOperations.completed ? ( - - {t('app:common.showMore')} - - - ) : ( - - - {t('app:operationList.noMoreOperations')} - - - )} - - + + )} + ) } } diff --git a/src/components/base/Defer.js b/src/components/base/Defer.js deleted file mode 100644 index 2044e054..00000000 --- a/src/components/base/Defer.js +++ /dev/null @@ -1,40 +0,0 @@ -// @flow - -import { PureComponent } from 'react' - -type Props = { - children: any, -} - -type State = { - shouldRender: boolean, -} - -class Defer extends PureComponent { - state = { - shouldRender: false, - } - - componentDidMount() { - this._mounted = true - - window.requestAnimationFrame(() => - window.requestAnimationFrame(() => this._mounted && this.setState({ shouldRender: true })), - ) - } - - componentWillUnmount() { - this._mounted = false - } - - _mounted = false - - render() { - const { children } = this.props - const { shouldRender } = this.state - - return shouldRender ? children : null - } -} - -export default Defer diff --git a/src/components/base/Modal/index.js b/src/components/base/Modal/index.js index 6d1f19d6..472f1ee3 100644 --- a/src/components/base/Modal/index.js +++ b/src/components/base/Modal/index.js @@ -19,7 +19,6 @@ import { closeModal, isModalOpened, getModalData } from 'reducers/modals' import Box from 'components/base/Box' import GrowScroll from 'components/base/GrowScroll' -import Defer from 'components/base/Defer' export { default as ModalBody } from './ModalBody' export { default as ConfirmModal } from './ConfirmModal' @@ -126,7 +125,7 @@ class Pure extends Component { render() { const { data, onClose, render } = this.props - return {render({ data, onClose })} + return render({ data, onClose }) } }