From e25d6b712d9ff694ae4762e7f1330f5ef45f0927 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Wed, 28 Feb 2018 16:09:56 +0100 Subject: [PATCH] chore(xo-web): addSubscriptions provide initial props (#2697) --- packages/xo-web/src/common/add-subscriptions.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/xo-web/src/common/add-subscriptions.js b/packages/xo-web/src/common/add-subscriptions.js index 0f14f7209..a927f879b 100644 --- a/packages/xo-web/src/common/add-subscriptions.js +++ b/packages/xo-web/src/common/add-subscriptions.js @@ -7,6 +7,16 @@ const call = fn => fn() // callbacks have been correctly initialized when there are circular dependencies const addSubscriptions = subscriptions => Component => class SubscriptionWrapper extends React.PureComponent { + constructor () { + super() + + // provide all props since the beginning (better behavior with Freactal) + const state = (this.state = {}) + Object.keys(subscriptions).forEach(key => { + state[key] = undefined + }) + } + _unsubscribes = null componentWillMount () {