GregoryConrad / rearch-dart

Re-imagined approach to application design and architecture
https://pub.dev/packages/rearch
MIT License
92 stars 4 forks source link

Future/Stream created in idempotent capsule may be incorrectly disposed #170

Closed GregoryConrad closed 6 months ago

GregoryConrad commented 6 months ago

Haven't actually tested this hypothesis so idk if this is true or not, but a test case needs to be added regardless. Since the start of a RearchConsumer build clears all dependencies with created with onNextUpdate, I'd think an idempotent capsule may be disposed as the build starts even if the capsule was used in the previous build. Thus, an idempotent capsule returning a future/stream might cause some janky issues if it is being disposed/recreated whenever a widget rebuilds.

If this is in fact an issue, switch up the RearchConsumer logic to instead hold onto dependencies during the build and only remove unused deps after the build completes.