Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Make CommitAllowingStateLoss the default (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
hartez authored and Jason Smith committed Nov 16, 2016
1 parent 20adf7e commit 243d9e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ protected override void AddChildView(VisualElement childView)
transaction.DisallowAddToBackStack();
transaction.Remove(_currentFragment);
transaction.SetTransition((int)FragmentTransit.None);
transaction.Commit();

// This is a removal of a fragment that's not going on the back stack; there's no reason to care
// whether its state gets successfully saved, since we'll never restore it. Ergo, CommitAllowingStateLoss
transaction.CommitAllowingStateLoss();

_currentFragment = null;
}
Expand Down Expand Up @@ -102,7 +105,10 @@ protected override void AddChildView(VisualElement childView)

transaction.Add(Id, fragment);
transaction.SetTransition((int)FragmentTransit.None);
transaction.Commit();

// We don't currently support fragment restoration
// So we don't need to worry about loss of this fragment's state
transaction.CommitAllowingStateLoss();

_currentFragment = fragment;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,10 @@ Task<bool> SwitchContentAsync(Page view, bool animated, bool removed = false, bo
fragments.Add(fragment);
}
}
transaction.Commit();

// We don't currently support fragment restoration, so we don't need to worry about
// whether the commit loses state
transaction.CommitAllowingStateLoss();

// The fragment transitions don't really SUPPORT telling you when they end
// There are some hacks you can do, but they actually are worse than just doing this:
Expand Down

0 comments on commit 243d9e0

Please sign in to comment.