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

Commit 3e560f3

Browse files
authored
Merge pull request #371 from github/shana/fix-prlist-refresh
Fix the pr list refresh and reload
2 parents 8a514ca + 981612f commit 3e560f3

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

src/GitHub.App/Controllers/UIController.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -736,16 +736,21 @@ bool CreateViewAndViewModel(UIViewType viewType, ViewWithData data = null)
736736
}
737737
}
738738

739-
if (!list.ContainsKey(viewType))
739+
IUIPair pair = null;
740+
var firstTime = !list.TryGetValue(viewType, out pair);
741+
742+
if (firstTime)
743+
pair = factory.CreateViewAndViewModel(viewType);
744+
745+
pair.ViewModel.Initialize(data);
746+
747+
if (firstTime)
740748
{
741-
var d = factory.CreateViewAndViewModel(viewType);
742-
d.ViewModel.Initialize(data);
743-
d.View.DataContext = d.ViewModel;
744-
list.Add(viewType, d);
745-
return true;
749+
pair.View.DataContext = pair.ViewModel;
750+
list.Add(viewType, pair);
746751
}
747752

748-
return false;
753+
return firstTime;
749754
}
750755

751756

@@ -834,6 +839,7 @@ public void Dispose()
834839

835840
public bool IsStopped => uiStateMachine.IsInState(UIViewType.None) || stopping;
836841
public UIControllerFlow CurrentFlow => activeFlow;
842+
public UIControllerFlow SelectedFlow => mainFlow;
837843
bool LoggedIn => connection != null && hosts.LookupHost(connection.HostAddress).IsLoggedIn;
838844
bool? Success { get; set; }
839845
}

src/GitHub.Exports/UI/IUIController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public interface IUIController
1717
void Stop();
1818
bool IsStopped { get; }
1919
UIControllerFlow CurrentFlow { get; }
20+
UIControllerFlow SelectedFlow { get; }
2021
void Jump(ViewWithData where);
2122
}
2223

src/GitHub.VisualStudio/UI/Views/GitHubPaneViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async Task Reload([AllowNull] ViewWithData data = null, bool navigating = false)
133133

134134
if (IsLoggedIn)
135135
{
136-
if (uiController == null || (data != null && data.ActiveFlow != uiController.CurrentFlow))
136+
if (uiController == null || (data != null && data.ActiveFlow != uiController.SelectedFlow))
137137
StartFlow(data?.ActiveFlow ?? UIControllerFlow.PullRequests, connection, data);
138138
else if (data != null || currentNavItem >= 0)
139139
uiController.Jump(data ?? navStack[currentNavItem]);

0 commit comments

Comments
 (0)