Closed faizsameerahmed96 closed 5 years ago
`async updateCounter(rooms) {
let unreadCounter = { ...this.state.unreadCounter } for (let item of rooms) { try { let doc = await db.findOneAsync({ forRoom: item._id }) if (!doc) { db.insert({ forRoom: item._id, noOfMessages: item.noOfMessages }) } else { if (item.noOfMessages > doc.noOfMessages) { console.log('UPDATE>>>>>>>>>>>>>') unreadCounter[item._id] = item.noOfMessages - doc.noOfMessages } } } catch (err) { console.error(err) } } console.log(unreadCounter) this.setState({ unreadCounter: { '5c6568a0c8e78c33705e9bda': 7 } }) }`
In the above function call whenever I try to setState it is not updating the view. However if I comment out the code for the query it rerenders the view. Am I doing something wrong or is this a bug?
I hope you have found a solution. I'm closing the issue because it does not seem like a problem with the package.
`async updateCounter(rooms) {
In the above function call whenever I try to setState it is not updating the view. However if I comment out the code for the query it rerenders the view. Am I doing something wrong or is this a bug?