chore(xo-web): addSubscriptions provide initial props (#2697)
This commit is contained in:
parent
b499d60130
commit
e25d6b712d
@ -7,6 +7,16 @@ const call = fn => fn()
|
|||||||
// callbacks have been correctly initialized when there are circular dependencies
|
// callbacks have been correctly initialized when there are circular dependencies
|
||||||
const addSubscriptions = subscriptions => Component =>
|
const addSubscriptions = subscriptions => Component =>
|
||||||
class SubscriptionWrapper extends React.PureComponent {
|
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
|
_unsubscribes = null
|
||||||
|
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
|
Loading…
Reference in New Issue
Block a user