From 98a1b97574e295547fd7d33d84613897d7f8e765 Mon Sep 17 00:00:00 2001 From: Luke Morris Date: Fri, 16 Feb 2018 22:15:16 -0800 Subject: [PATCH] No need for bindActionCreators --- ui/src/shared/components/Annotations.js | 5 ----- ui/src/shared/components/NewAnnotation.js | 15 +++++++-------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/ui/src/shared/components/Annotations.js b/ui/src/shared/components/Annotations.js index 5a4f0729dd..b927b2f89f 100644 --- a/ui/src/shared/components/Annotations.js +++ b/ui/src/shared/components/Annotations.js @@ -10,7 +10,6 @@ import * as schema from 'src/shared/schemas' import {ADDING, TEMP_ANNOTATION} from 'src/shared/annotations/helpers' import { - addAnnotation, updateAnnotation, deleteAnnotation, addingAnnotationSuccess, @@ -34,7 +33,6 @@ class Annotations extends Component { const { mode, isTempHovering, - handleAddAnnotation, handleUpdateAnnotation, handleDeleteAnnotation, handleDismissAddingAnnotation, @@ -59,7 +57,6 @@ class Annotations extends Component { ({ mouseLeaveTempAnnotation, dispatch ), - handleAddAnnotation: bindActionCreators(addAnnotation, dispatch), handleUpdateAnnotation: bindActionCreators(updateAnnotation, dispatch), handleDeleteAnnotation: bindActionCreators(deleteAnnotation, dispatch), }) diff --git a/ui/src/shared/components/NewAnnotation.js b/ui/src/shared/components/NewAnnotation.js index eff76944fc..b9b75ca587 100644 --- a/ui/src/shared/components/NewAnnotation.js +++ b/ui/src/shared/components/NewAnnotation.js @@ -1,7 +1,6 @@ import React, {Component, PropTypes} from 'react' import classnames from 'classnames' import {connect} from 'react-redux' -import {bindActionCreators} from 'redux' import uuid from 'node-uuid' import OnClickOutside from 'shared/components/OnClickOutside' @@ -33,7 +32,7 @@ class NewAnnotation extends Component { handleMouseUp = () => { const { - addAnnotation, + addAnnotationAsync, onAddingAnnotationSuccess, tempAnnotation, onMouseLeaveTempAnnotation, @@ -48,7 +47,7 @@ class NewAnnotation extends Component { // time on mouse up const endTime = tempAnnotation.startTime - addAnnotation(createUrl, { + addAnnotationAsync(createUrl, { ...tempAnnotation, startTime, endTime, @@ -67,7 +66,7 @@ class NewAnnotation extends Component { onAddingAnnotationSuccess() onMouseLeaveTempAnnotation() - addAnnotation(createUrl, { + addAnnotationAsync(createUrl, { ...tempAnnotation, id: uuid.v4(), startTime, @@ -196,7 +195,7 @@ NewAnnotation.propTypes = { dygraph: shape({}).isRequired, isTempHovering: bool, tempAnnotation: schema.annotation.isRequired, - addAnnotation: func.isRequired, + addAnnotationAsync: func.isRequired, onDismissAddingAnnotation: func.isRequired, onAddingAnnotationSuccess: func.isRequired, onUpdateAnnotation: func.isRequired, @@ -204,8 +203,8 @@ NewAnnotation.propTypes = { onMouseLeaveTempAnnotation: func.isRequired, } -const mdtp = dispatch => ({ - addAnnotation: bindActionCreators(actions.addAnnotationAsync, dispatch), -}) +const mdtp = { + addAnnotationAsync: actions.addAnnotationAsync, +} export default connect(null, mdtp)(OnClickOutside(NewAnnotation))