Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

fix(ui): close channel create modal after channel opening is finished #2923

Merged
merged 3 commits into from
Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions renderer/containers/Channels/ChannelCreate.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { connect } from 'react-redux'
import ChannelCreate from 'components/Channels/ChannelCreate'
import { closeModal } from 'reducers/modal'
import { updateContactFormSearchQuery, contactFormSelectors } from 'reducers/contactsform'

const onSubmit = () => closeModal()

const mapStateToProps = state => ({
searchQuery: state.contactsform.searchQuery,
isSearchValidNodeAddress: contactFormSelectors.isSearchValidNodeAddress(state),
})

const mapDispatchToProps = {
updateContactFormSearchQuery,
onSubmit,
}

export default connect(
Expand Down
9 changes: 0 additions & 9 deletions renderer/reducers/channels.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createSelector } from 'reselect'
import { proxyValue } from 'comlinkjs'
import orderBy from 'lodash/orderBy'
import throttle from 'lodash/throttle'
import config from 'config'
Expand Down Expand Up @@ -546,10 +545,6 @@ export const openChannel = data => async (dispatch, getState) => {
spendUnconfirmed,
})
dispatch(pushchannelupdated(data))
grpc.services.Lightning.once(
'openChannel.data',
proxyValue(data => dispatch(pushchannelupdated(data)))
)
} catch (e) {
dispatch(
pushchannelerror({
Expand Down Expand Up @@ -647,10 +642,6 @@ export const closeChannel = () => async (dispatch, getState) => {
force: !active,
})
dispatch(pushclosechannelupdated(data))
grpc.services.Lightning.once(
'closeChannel.data',
proxyValue(data => dispatch(pushclosechannelupdated(data)))
)
} catch (e) {
dispatch(
pushchannelerror({
Expand Down
8 changes: 0 additions & 8 deletions services/grpc/lightning.methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,26 +175,22 @@ async function openChannel(payload = {}) {
call.on('data', data => {
grpcLog.debug('OPEN_CHANNEL DATA', data)
const response = { ...parsePayload(payload), data }
this.emit('openChannel.data', response)
resolve(response)
})

call.on('error', data => {
grpcLog.error('OPEN_CHANNEL ERROR', data)
const error = new Error(data.message)
error.payload = parsePayload(payload)
this.emit('openChannel.error', error)
reject(error)
})

call.on('status', status => {
grpcLog.debug('OPEN_CHANNEL STATUS', status)
this.emit('openChannel.status', status)
})

call.on('end', () => {
grpcLog.debug('OPEN_CHANNEL END')
this.emit('openChannel.end')
})
} catch (e) {
const error = new Error(e.message)
Expand Down Expand Up @@ -235,26 +231,22 @@ async function closeChannel(payload = {}) {
call.on('data', data => {
grpcLog.debug('CLOSE_CHANNEL DATA', data)
const response = { data, chan_id }
this.emit('closeChannel.data', response)
resolve(response)
})

call.on('error', data => {
grpcLog.error('CLOSE_CHANNEL ERROR', data)
const error = new Error(data.message)
error.payload = { chan_id }
this.emit('closeChannel.error', error)
reject(error)
})

call.on('status', status => {
grpcLog.debug('CLOSE_CHANNEL STATUS', status)
this.emit('closeChannel.status', status)
})

call.on('end', () => {
grpcLog.debug('CLOSE_CHANNEL END')
this.emit('closeChannel.end')
})
} catch (e) {
const error = new Error(e.message)
Expand Down