-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Hold weak reference only #3157
Closed
Closed
Hold weak reference only #3157
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still seem like there are cases where views can be kept in those dicts. Specifically, it appears like the only codepath that leads to the removal is when the given view is returned from
findRoot
. ButfindRoot
can in some cases return the parent of a given view and not the view itself. It'd feel safer if we have a cleaner contract as to when given view needs to be removed from an array. Also it'd be good to add a few lines of documentation for each of these two new dicts. I can understand the purpose ofviewWithExitingAnimations
fine by its name but not so much withviewToRemove
– i.e. I don't know why we need to keep track of all views we remove.As to "a cleaner contract" an example would be to always remove object from
viewWithExitingAnimations
after animation is finished (have a callback of some sort ?). WithviewsToRemove
we should ideally have something similar. Now it is very difficult to track the codepath that leads to deletion and it can be altered to easily.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mateioprea is that maybe your case, when calling
reset
on navigator, which leaves views mounted even after applying this fix?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, in the perf monitor i can see that the total number of rendered view increase over time.
My app's lifecycle is:
Mount 1st screen -> navigate to 2nd screen -> navigate to 3rd screen -> navigate to last screen -> Reset navigation to 1st screen and then start again the same cycle.
Previously I've seen custom UI views not being unmounted but this PR fixes that issue. But i can see an increase of total number of rendered views with each new session.