Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit c27a374

Browse files
committed
Make sure publish form goes away when it's done
We now track completion state of the publish repo process so that we can fire Done() only when it's actually done... otherwise the observable subscriptions waiting for things to be done will get disposed after the first publish attempt, and if that fails, well, subscriptions are completed and disposed so the form stops reacting to anything else.
1 parent e448a9d commit c27a374

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

src/GitHub.App/Controllers/UIController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ public IObservable<bool> ListenToCompletionState()
150150
void End(bool success)
151151
{
152152
uiProvider.RemoveService(typeof(IConnection));
153+
transition.OnCompleted();
153154
completion.OnNext(success);
154155
completion.OnCompleted();
155-
transition.OnCompleted();
156156
}
157157

158158
void RunView(UIViewType viewType)

src/GitHub.UI.Reactive/Controls/SimpleViewUserControl.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,27 @@ public SimpleViewUserControl()
4343

4444
protected void NotifyDone()
4545
{
46+
if (disposed)
47+
return;
48+
4649
close.OnNext(null);
4750
close.OnCompleted();
4851
}
4952

5053
protected void NotifyCancel()
5154
{
55+
if (disposed)
56+
return;
57+
5258
cancel.OnNext(null);
5359
cancel.OnCompleted();
5460
}
5561

5662
protected void NotifyIsBusy(bool busy)
5763
{
64+
if (disposed)
65+
return;
66+
5867
isBusy.OnNext(busy);
5968
}
6069

src/GitHub.VisualStudio/TeamExplorer/Sync/GitHubPublishSection.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,8 @@ void ShowPublish()
119119
var creation = ui.SelectFlow(UIControllerFlow.Publish);
120120
ui.ListenToCompletionState().Subscribe(done =>
121121
{
122-
if (done)
123-
{
124-
IsVisible = false;
125-
ServiceProvider.TryGetService<ITeamExplorer>()?.NavigateToPage(new Guid(TeamExplorerPageIds.Home), null);
126-
}
122+
IsVisible = false;
123+
ServiceProvider.TryGetService<ITeamExplorer>()?.NavigateToPage(new Guid(TeamExplorerPageIds.Home), null);
127124
});
128125

129126
creation.Subscribe(c =>

src/GitHub.VisualStudio/UI/Views/Controls/RepositoryPublishControl.xaml.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ public RepositoryPublishControl()
4646

4747
ViewModel.PublishRepository.Subscribe(state =>
4848
{
49-
if (state == ProgressState.Fail)
50-
NotifyCancel();
51-
else
49+
if (state == ProgressState.Success)
5250
NotifyDone();
5351
});
5452

0 commit comments

Comments
 (0)