hack4impact-uiuc / 7000-languages

Helping Indigenous communities around the world teach, learn and sustain their languages
GNU General Public License v3.0
12 stars 2 forks source link

Fix async image loading bug #258

Closed chenfeiyu132 closed 2 years ago

chenfeiyu132 commented 2 years ago

Status:

:rocket: Ready

Description

There was an issue with the previous PR #242 where the updates would overwrite the existing images that are loaded due to stale data. This PR fixes that issue. Images are now loading asynchronously and updating correctly with current data.

Also fixed a warning that was related to the async callback functions updating the data state after the component(LessonHome) is unmounted. Added a ref hook to keep track of whether the component has unmounted so we could avoid updating an unmounted component.