function* watchBranchPointDeletion(): Generator<*, *, *> { let lastActionCreatedNode = true; while (true) { const { deleteBranchpointAction } = yield race({ deleteBranchpointAction: take("REQUEST_DELETE_BRANCHPOINT"), createNodeAction: take("CREATE_NODE"), }); if (deleteBranchpointAction) { const hasBranchPoints = yield select( state => getBranchPoints(state.tracing).getOrElse([]).length > 0, ); if (hasBranchPoints) { if (lastActionCreatedNode === true) { yield put(deleteBranchPointAction()); } else { Modal.confirm({ title: "Jump again?", content: messages["tracing.branchpoint_jump_twice"], okText: "Jump again!", onOk: () => { Store.dispatch(deleteBranchPointAction()); }, }); } lastActionCreatedNode = false; } else { Toast.warning(messages["tracing.no_more_branchpoints"]); } } else { lastActionCreatedNode = true; } } }
handleOk = () => { // public tracings only work if the dataset is public too const isPublic = this.state.isPublic; if (!this.props.isDatasetPublic && isPublic) { Toast.warning(messages["annotation.dataset_no_public"], { sticky: true }); } this.props.setAnnotationPublic(isPublic); this.props.onOk(); };