commit 5d2baaf85e39c3d5244d9ba3519e238f0a08b7b1
parent 703801b1d3359ceda11c351788abbe62b1614dc9
Author: Johan Lindskogen <johan.lindskogen@gmail.com>
Date: Sun, 1 Apr 2018 17:26:44 +0200
Dispatch change buffer only if different
Diffstat:
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/usecase/App.tsx b/src/usecase/App.tsx
@@ -29,9 +29,16 @@ class App extends React.Component<Props> {
drawer: Drawer;
changeCurrentBuffer = buffer => {
+ const { currentBufferId, fetchLinesForBuffer } = this.props;
+
this.drawer.close();
- this.props.dispatch({ type: "CHANGE_CURRENT_BUFFER", bufferId: buffer.id });
- this.props.fetchLinesForBuffer(buffer.id);
+ if (currentBufferId !== buffer.id) {
+ this.props.dispatch({
+ type: "CHANGE_CURRENT_BUFFER",
+ bufferId: buffer.id
+ });
+ fetchLinesForBuffer(buffer.id);
+ }
};
render() {
const {
@@ -105,7 +112,8 @@ const styles = StyleSheet.create({
flexDirection: "row",
backgroundColor: "#333",
justifyContent: "center",
- alignItems: "center"
+ alignItems: "center",
+ paddingBottom: 10
},
channels: {
flex: 1,