Simplify mapStateToProps & mapDispatchToProps
parent
46e9d305a3
commit
891397ffcd
|
@ -1,7 +1,6 @@
|
||||||
import React, {Component} from 'react'
|
import React, {Component} from 'react'
|
||||||
import {connect} from 'react-redux'
|
import {connect} from 'react-redux'
|
||||||
import {withRouter} from 'react-router'
|
import {withRouter} from 'react-router'
|
||||||
import {bindActionCreators} from 'redux'
|
|
||||||
|
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
|
@ -575,7 +574,7 @@ class DashboardPage extends Component<Props, State> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state, {params: {dashboardID}}) => {
|
const mstp = (state, {params: {dashboardID}}) => {
|
||||||
const {
|
const {
|
||||||
app: {
|
app: {
|
||||||
ephemeral: {inPresentationMode},
|
ephemeral: {inPresentationMode},
|
||||||
|
@ -627,38 +626,18 @@ const mapStateToProps = (state, {params: {dashboardID}}) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mdtp = {
|
||||||
handleChooseAutoRefresh: bindActionCreators(setAutoRefresh, dispatch),
|
handleChooseAutoRefresh: setAutoRefresh,
|
||||||
templateControlBarVisibilityToggled: bindActionCreators(
|
templateControlBarVisibilityToggled: templateControlBarVisibilityToggledAction,
|
||||||
templateControlBarVisibilityToggledAction,
|
handleClickPresentationButton: delayEnablePresentationMode,
|
||||||
dispatch
|
dashboardActions: dashboardActionCreators,
|
||||||
),
|
errorThrown: errorThrownAction,
|
||||||
handleClickPresentationButton: bindActionCreators(
|
notify: notifyAction,
|
||||||
delayEnablePresentationMode,
|
getAnnotationsAsync: annotationActions.getAnnotationsAsync,
|
||||||
dispatch
|
handleShowCellEditorOverlay: showCellEditorOverlay,
|
||||||
),
|
handleHideCellEditorOverlay: hideCellEditorOverlay,
|
||||||
dashboardActions: bindActionCreators(dashboardActionCreators, dispatch),
|
handleDismissEditingAnnotation: dismissEditingAnnotation,
|
||||||
errorThrown: bindActionCreators(errorThrownAction, dispatch),
|
handleShowOverlay: showOverlay,
|
||||||
notify: bindActionCreators(notifyAction, dispatch),
|
}
|
||||||
getAnnotationsAsync: bindActionCreators(
|
|
||||||
annotationActions.getAnnotationsAsync,
|
|
||||||
dispatch
|
|
||||||
),
|
|
||||||
handleShowCellEditorOverlay: bindActionCreators(
|
|
||||||
showCellEditorOverlay,
|
|
||||||
dispatch
|
|
||||||
),
|
|
||||||
handleHideCellEditorOverlay: bindActionCreators(
|
|
||||||
hideCellEditorOverlay,
|
|
||||||
dispatch
|
|
||||||
),
|
|
||||||
handleDismissEditingAnnotation: bindActionCreators(
|
|
||||||
dismissEditingAnnotation,
|
|
||||||
dispatch
|
|
||||||
),
|
|
||||||
handleShowOverlay: bindActionCreators(showOverlay, dispatch),
|
|
||||||
})
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(
|
export default connect(mstp, mdtp)(ManualRefresh(withRouter(DashboardPage)))
|
||||||
ManualRefresh(withRouter(DashboardPage))
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in New Issue