forked from microsoft/PowerToys
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
Loading
on pages (microsoft#290)
This subtly regressed in microsoft#244, so subtly that I didn't really notice it till I fixed it. In that PR, we replaced the `visibility` binding of the `ProgressBar` with a binding to `IsInitialized`. For most pages, this actually just works fine - they're only initialized once they return some results. And most pages are only loading until they first return something. But the trick is with pages that do some `Loading` _after_ they're initialized. For them, the progress bar never shows up, because `Initialized` is already true. I actually only stumbled upon this because of a totally different bug (which this also fixes). In rare cases we'd load a little out of order, and the ShellPage would try to determine if it should hide the `ErrorMessage` or not. About 25% of the time, it would evaluate `{x:Bind ViewModel.CurrentPage.ErrorMessage, Converter={StaticResource StringNotEmptyToVisibilityConverter}, Mode=OneWay}` _before_ the `CurrentPage` got set, so it would show it initially. That looked real janky.
- Loading branch information
1 parent
0bd356c
commit 4b9b15f
Showing
5 changed files
with
31 additions
and
7 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/LoadingPageViewModel.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.CmdPal.Extensions; | ||
|
||
namespace Microsoft.CmdPal.UI.ViewModels; | ||
|
||
public partial class LoadingPageViewModel : PageViewModel | ||
{ | ||
public LoadingPageViewModel(IPage? model, TaskScheduler scheduler) | ||
: base(model, scheduler) | ||
{ | ||
ModelIsLoading = true; | ||
IsInitialized = false; | ||
} | ||
} |
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
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
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
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