Temp annotation is removed via another action

pull/10616/head
Luke Morris 2018-02-22 10:55:16 -08:00
parent 66dfd2dd6d
commit a1e7b4ed29
2 changed files with 6 additions and 11 deletions

View File

@ -24,7 +24,7 @@ class AnnotationTooltip extends Component {
}
handleConfirmUpdate = () => {
this.props.updateAnnotation(this.state.annotation)
this.props.updateAnnotationAsync(this.state.annotation)
}
handleRejectUpdate = () => {
@ -67,13 +67,13 @@ class AnnotationTooltip extends Component {
</button>}
{isEditing
? <AnnotationInput
value={annotation.name}
onChangeInput={this.handleChangeInput('name')}
value={annotation.text}
onChangeInput={this.handleChangeInput('text')}
onConfirmUpdate={this.handleConfirmUpdate}
onRejectUpdate={this.handleRejectUpdate}
/>
: <div>
{annotation.name}
{annotation.text}
</div>}
<TimeStamp time={timestamp} />
</div>}
@ -94,10 +94,10 @@ AnnotationTooltip.propTypes = {
onMouseLeave: func.isRequired,
annotationState: shape({}),
deleteAnnotationAsync: func.isRequired,
updateAnnotation: func.isRequired,
updateAnnotationAsync: func.isRequired,
}
export default connect(null, {
deleteAnnotationAsync: actions.deleteAnnotationAsync,
updateAnnotation: actions.updateAnnotation,
updateAnnotationAsync: actions.updateAnnotationAsync,
})(AnnotationTooltip)

View File

@ -35,14 +35,9 @@ const annotationsReducer = (state = initialState, action) => {
}
case 'ADDING_ANNOTATION_SUCCESS': {
const annotations = state.annotations.filter(
a => a.id !== TEMP_ANNOTATION.id
)
return {
...state,
mode: null,
annotations,
}
}