gliff-ai / curate

gliff.ai CURATE – a user-friendly browser interface for curating large multidimensional image datasets for machine learning development
https://gliff.ai
GNU Affero General Public License v3.0
2 stars 0 forks source link

fix: deselect deleted images on props update #432

Closed philipjackson closed 2 years ago

philipjackson commented 2 years ago

Description

Fixes the crash that happens when deleting an image. Was happening because this.state.selectedImagesUid wasn't updating when images were deleted, so it was still trying to find a selected image that no longer existed, getting undefined from find, and passing that into MetadataDrawer. Rather than deselect the image when the callback is fired, which still allows the crash to happen if for some reason the user re-selects the image before it disappears, I've gone with updating selectedImagesUid in componentDidUpdate when the props change.

Checklist:

Put an x in the boxes that apply to this pull request (you can also fill these out after opening the pull request). If you're unsure about any of these, don't hesitate to leave a comment on this pull request!

github-actions[bot] commented 2 years ago

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-meadow-05ee3f103-432.westeurope.azurestaticapps.net