I use react (15.6.1) and react-router (v4) on client side. And it is the first time I am using react-router v4 (I used to use the previous versions). The problem is, when I subscribe to a publication on the client side, it immediately fires onStop callback with no error argument. I don’t stop subscription anywhere in my code, it stops itself. I’ve been trying to understand it for a whole day, yet I can’t solve the problem.
import React, { Component } from 'react'
import { createContainer } from 'meteor/react-meteor-data'
import { PagesCollection } from '/api/pages'
const defaultState = {
}
class RolesContainer extends Component {
constructor(props) {
super(props)
this.state = defaultState
}
componentWillMount() {
Meteor.subscribe('pages', {
onReady: () => {
console.log('ready')
},
onStop(err) {
console.log('stop', err)
}
})
}
render() {
const { pages } = this.props
return(
<Roles context={this}/>
);
}
}
export default createContainer(() => {
return {
pages: PagesCollection.find().fetch(),
}
}, RolesContainer)
I subscribe to publication inside componentWillMount (as I always did in my previous projects).
What could be the problem?