Astra-Labs / Aureus

An open-source design system for non-profits to quickly develop user safety critical applications.
https://withaureus.org/
Other
13 stars 1 forks source link

Check ContainerView notification observer bug. #57

Closed codingiswhyicry closed 1 year ago

codingiswhyicry commented 1 year ago

While debugging Verena, noticed that after opening a 'dialogue' within a view and then exiting the screen, that specific container view doesn't allow for any future dialogue prompts to be opened. I think this is an object release / state management issue, but added it to track that it's being fixed.

https://user-images.githubusercontent.com/10201992/217648664-13a13f06-89f5-4863-a04e-aebb50f4f35d.mp4

codingiswhyicry commented 1 year ago

Adding to this that I've been debugging a bit and the ContainerView widget is not properly being disposed of, and hence never 'unregisters' from the observer.

I should potentially make this a delegate pattern, IMO. It was an oversight on my part to make notifications observable by more than one view at a time. I'll potentially look into correcting this by only allowing one observer at a time, and/or looking into the Navigator to see if we can fix the disposing problem.

But IMO both should be tracked down because this was an architecture oversight on my part.

codingiswhyicry commented 1 year ago

This is related to this issue being open in Flutter: https://github.com/flutter/flutter/issues/40940

TLDR: Flutter's dispose method doesn't always get called 100% of the time, even when the app life cycle changes or the Navigator changes the current screen. I did end up re-writing the observer code to only maintain one observer (since only one view is visible at a time and it's the proper way to do this), but ultimately it is a dispose issue and a matter of overriding another method that is more reliably called.

codingiswhyicry commented 1 year ago

This has been been resolved :-)