weechatRN

Weechat relay client for iOS using websockets https://github.com/mhoran/weechatRN
git clone http://git.hanabi.in/repos/weechatRN.git
Log | Files | Refs | README | LICENSE

commit 446e0954074f281c2d82712b300b17c0b78bfa2b
parent 4c501bc90bebed08525c85df3ddeaee50f6b0c7c
Author: Matthew Horan <matt@matthoran.com>
Date:   Tue, 19 Mar 2019 22:55:59 -0400

Don't set currentBufferId to a closed buffer

If weechat has restarted, or a buffer has been closed while weechatRN is
disconnected, then we will have an incorrect pointer set in
currentBufferId.

While weechat handles this just fine, weechatRN behaves like a buffer is
"mostly" open, in that the previous lines will show up but the drawer
will remain closed and the topic will be unset.

Fixes #14.

Diffstat:
Msrc/usecase/App.tsx | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/usecase/App.tsx b/src/usecase/App.tsx @@ -105,7 +105,7 @@ class App extends React.Component<Props, State> { const { currentBufferId, fetchBufferInfo } = this.props; if (currentBufferId) { - fetchBufferInfo(this.props.currentBufferId); + fetchBufferInfo(currentBufferId); } else { this.drawer.openDrawer(); } @@ -115,6 +115,13 @@ class App extends React.Component<Props, State> { Dimensions.removeEventListener('change', this.updateWidth); } + componentDidUpdate(prevProps: Props) { + const { currentBufferId } = this.props; + if (currentBufferId !== prevProps.currentBufferId && !currentBufferId) { + this.drawer.openDrawer(); + } + } + render() { const { buffers, @@ -176,7 +183,6 @@ class App extends React.Component<Props, State> { </View> <BufferContainer showTopic={showTopic} - buffer={currentBuffer} sendMessage={this.sendMessage} bufferId={currentBufferId} /> @@ -198,7 +204,7 @@ export default connect((state: StoreState) => { return { buffers: state.buffers, - currentBufferId, + currentBufferId: currentBuffer && currentBufferId, currentBuffer, hasHighlights: numHighlights > 0 };