Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There's no way for InheritedElement to know that a dependent has been deactivated #129207

Closed
2 tasks done
s0nerik opened this issue Jun 20, 2023 · 2 comments · Fixed by #129210
Closed
2 tasks done

There's no way for InheritedElement to know that a dependent has been deactivated #129207

s0nerik opened this issue Jun 20, 2023 · 2 comments · Fixed by #129210
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter framework flutter/packages/flutter repository. See also f: labels. P3 Issues that are less important to the Flutter project

Comments

@s0nerik
Copy link
Contributor

s0nerik commented Jun 20, 2023

Is there an existing issue for this?

Use case

I'm finishing the promising-looking, easy-to-use approach to state management, which requires that InheritedElement is notified when the dependent has been removed from the dependents list to properly close all value change subscriptions upon dependent element deactivation.

Proposal

Call the dependency.onDependentRemoved(this) right after dependency._dependents.remove(this) inside the Element.deactivate()

@darshankawar darshankawar added in triage Presently being triaged by the triage team c: new feature Nothing broken; request for a new capability framework flutter/packages/flutter repository. See also f: labels. c: proposal A detailed proposal for a change to Flutter and removed in triage Presently being triaged by the triage team labels Jun 21, 2023
@goderbauer goderbauer added the P6 label Jun 27, 2023
@flutter-triage-bot flutter-triage-bot bot added P3 Issues that are less important to the Flutter project and removed P6 labels Jun 28, 2023
@goderbauer
Copy link
Member

Duplicate of #128432.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 21, 2023
auto-submit bot pushed a commit that referenced this issue Nov 3, 2023
Call the `dependency.removeDependent(this)` instead of `dependency._dependents.remove(this)` inside the `Element.deactivate()`. This allows `InheritedElements` to know when they can release resources associated with a given dependent `Element`.

Fixes #129207
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter framework flutter/packages/flutter repository. See also f: labels. P3 Issues that are less important to the Flutter project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants