Remove HistoryListFragment.onSaveInstanceState#10405
Merged
shiki merged 1 commit intorelease/13.0from Aug 19, 2019
Merged
Conversation
The value we save in WordPress.SITE is not used at all. Also, this causes a crash if the bundle saving kicks in before the ViewModel is fully initialized.
maxme
approved these changes
Aug 19, 2019
Contributor
maxme
left a comment
There was a problem hiding this comment.
It looks like we do not use that key anyway.
Yep, I had a look at the history and from the first version it seems unused. I also checked that the viewModel couldn't be used beforeviewModel.create in this file.
Using the
argumentsfor state restoration should be enough since they should be retained automatically.
Looks good, the post id and the SiteModel will be restored.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #10401.
Findings
This was caused by the “fix” in #10240. The only way I could think of why this happens is this scenario:
HistoryViewModel.HistoryViewModelwasn't fully initialized yet.I can consistently reproduce this scenario by adding a
delay(). To do that, change theval post: PostModel?line inHistoryViewModel.create()to this:This adds a 5 second delay of the loading. Turn on Don't keep activities in your device's Developer options. And then perform the steps above. The app should crash.
Solution
I removed the
onSaveInstanceStateofHistoryListFragment. It looks like we do not use that key anyway. We rely on theFragmentargumentsto load theSiteModel. Using theargumentsfor state restoration should be enough since they should be retained automatically.Testing
Please repeat the steps described in the Findings section and validate that the app does not crash anymore.
Reviewing
Only 1 reviewer is needed but anyone can review.
Release Notes
RELEASE-NOTES.txt.