mycoralhealth / mycoral-patient

Mobile app for patients to interact with Coral Health blockchain
17 stars 7 forks source link

Fix issues with state being updated on unmounted component. #54

Closed grcevski closed 6 years ago

grcevski commented 6 years ago

Fixes #46

The issue seems to be that we call setState from promises, which means that sometimes the component may be unmounted when the promise resolves. This causes that ugly yellow message about the state update being a no-op.

It seems that similar issue can happen in base react and this stackoverflow post describes some of the solutions. The most voted result seemed the simplest to implement:

https://stackoverflow.com/questions/34544314/setstate-can-only-update-a-mounted-or-mounting-component-this-usually-mea

coryheath commented 6 years ago

:shipit: This branch has been deployed to: https://expo.io/@mycoralhealthdev/mycoral-patient-fix-state-update

Download the Expo app and scan this QR code to get started!

QR Code

coryheath commented 6 years ago

:shipit: This branch has been deployed to: https://expo.io/@mycoralhealthdev/mycoral-patient-fix-state-update

Download the Expo app and scan this QR code to get started!

QR Code

lukecyca commented 6 years ago

LGTM