couchbaselabs/mobile-training-todo

[React Native]Error: undefined is not an object (evaluating 'this.feed.stop')

Opened this issue · 2 comments

When i navigate the screen between Lists and List Details continuously, following error is occurred on every 5th to 8th attempt in ListDetail> index.js on ComponentWillUnmount,
undefined is not an object (evaluating 'this.feed.stop')

` componentWillMount() {
console.log('ListDetail mounted');
this.setupQueries();
manager.database.get_db({db: DB_NAME})
.then(res => {
this.feed = new Feed(res.obj.update_seq, () => {
this.setupQueries();
});
console.log('ListDetail mounted Feed:'+this.feed);
});
}

componentWillUnmount() {
console.log('ListDetail unmounted');
console.log('ListDetail unmounted Feed:'+this.feed);
this.feed.stop();
}`

Log message:
Attempt 7:
ListDetail mounted
ListDetail mounted Feed:[object Object]
ListDetail unmounted
ListDetail unmounted Feed:[object Object]
Attempt : 8
ListDetail mounted
ListDetail unmounted
ListDetail unmounted Feed:undefined
undefined is not an object (evaluating 'this.feed.stop') <=== Error
ListDetail mounted Feed:[object Object]

From the above log it shows in componentWillMount(), Feed is initialized after some delay (say 10 sec) and if the componentWillUnmount is triggered within this time period (<10sec) the reported error appears.

error

I am reopening the issue, to fix the bug in example app.