Open shaunanoordin opened 3 years ago
I'm unsure if this is still needed. React no longer uses componentWillUnmount
and SingleImageViewer has been refactored to a functional component since this Issue was opened. @shaunanoordin when you have time, will you double check if this Issue is still a recommended refactor?
Lifecycle Improvement
Packages:
lib-classifier
,app-project
(see note-1) Component: Subject Viewer -> Single Image Viewer Follows #2221 (initial issue) and #2241 (initial solution)Context:
2241 fixes the lifecycle bug by adding a "placeholder image" for the "image file is loading" phase.
While we have a basic solution to the pertinent problem, we can still improve the component lifecycle. One idea is to perform a proper cleanup after the component unmounts.
Recommended Enhancement:
SingleImageViewer
component unmounts (i.e. runscomponentWillUnmount()
), it should runresetSubject()
to clean up the state of the Subject.resetSubject()
ONLY resets the Subject back to a "loading state". It shouldn't change other parameters (e.g. it shouldn't skip the Subject and move to the next one in the queue, or erase existing annotations!) or otherwise break functionality. We just want to ensure the lifecycle assumptions are followed, is all.(note 1) the actual code changes need to be made in lib-classifier, but the behaviour can only be tested on app-project/
Status
Recommended enhancement. Low urgency since it's not breaking anything at the moment, that we know if, but a clean lifecycle is the correct way to do things.