From 6436c0016220266bfdd808feef30714c783098e7 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Sun, 19 Nov 2017 02:10:29 -0200 Subject: [PATCH] :x --- app/lib/realm.js | 4 +++- app/sagas/login.js | 2 +- app/views/RoomView.js | 5 ++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/lib/realm.js b/app/lib/realm.js index 75a21df1..adf877fe 100644 --- a/app/lib/realm.js +++ b/app/lib/realm.js @@ -18,7 +18,9 @@ const settingsSchema = { _server: 'servers', valueAsString: { type: 'string', optional: true }, valueAsBoolean: { type: 'bool', optional: true }, - valueAsNumber: { type: 'int', optional: true } + valueAsNumber: { type: 'int', optional: true }, + + _updatedAt: { type: 'date', optional: true } } }; diff --git a/app/sagas/login.js b/app/sagas/login.js index bd9b5287..bfa8cde2 100644 --- a/app/sagas/login.js +++ b/app/sagas/login.js @@ -145,7 +145,7 @@ const handleForgotPasswordRequest = function* handleForgotPasswordRequest({ emai }; const root = function* root() { - yield takeEvery(types.SERVER.CHANGED, handleLoginWhenServerChanges); + yield takeLatest(types.SERVER.CHANGED, handleLoginWhenServerChanges); yield takeLatest(types.LOGIN.REQUEST, handleLoginRequest); yield takeLatest(types.LOGIN.SUCCESS, saveToken); yield takeLatest(types.LOGIN.SUBMIT, handleLoginSubmit); diff --git a/app/views/RoomView.js b/app/views/RoomView.js index f60f0b8d..27a39ba9 100644 --- a/app/views/RoomView.js +++ b/app/views/RoomView.js @@ -86,7 +86,7 @@ export default class RoomView extends React.Component { .sorted('ts', true); this.state = { slow: false, - dataSource: ds.cloneWithRows(this.data), + dataSource: ds.cloneWithRows([]), loaded: true, joined: typeof props.rid === 'undefined' }; @@ -102,10 +102,9 @@ export default class RoomView extends React.Component { this.timer = setTimeout(() => this.setState({ slow: true }), 5000); this.props.getMessages(this.rid); this.data.addListener(this.updateState); - this.state.dataSource = ds.cloneWithRows(this.data); } componentDidMount() { - + this.updateState(); } componentDidUpdate() { return !this.props.loading && clearTimeout(this.timer);