New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull requests button disappears when changing from a non-GitHub to a GitHub repository #2107

Merged
merged 6 commits into from Dec 6, 2018

Conversation

Projects
None yet
3 participants
@jcansdale
Copy link
Collaborator

jcansdale commented Dec 5, 2018

There can be delay before IsAGitHubRepo returns its result. If the repository changes before the call returns, the button can end up with the visibility for the wrong repository.

This fix only sets the button visibility if the repository hasn't changed. Button is invalidated multiple times, so one of them returns the visibility for the correct repository.

What this PR does

  • Don't change button visibility if repo changed after async call was made

What this PR doesn't do

This is probably only one of a number of issues like this. This is a point fix for the pull requests button disappearing (this is likely to have the most impact). Unfortunately the Team Explorer integration code has become fix upon fix and is difficult to work with and test.

Ideally we would create a view-model that controls visibility of all repository related buttons and UI inside Team Explorer. This would be a large (but worthwhile) refactoring, but is out of scope for this fix.

How to repro

  1. Open a Git repository that isn't on GitHub (e.g. one from Azure DevOps)
  2. Open a Git repository that is on GitHub
  3. Expect the pull request button to appear and then disappear

This is what it ends up looking like:

image

How to test

  1. Open a Git repository that isn't on GitHub (e.g. one from Azure DevOps)
  2. Open a Git repository that is on GitHub
  3. Expect the pull request button to appear and remain!

jcansdale added some commits Dec 5, 2018

Don't change button visibility if repo has changed
There can be delay before IsAGitHubRepo returns its result. If the
repository changes before the call returns, the button can end up with
the visibility for the wrong repository.

This fix only sets the button visibility if the repository hasn't
changed. Button is invalidated multiple times, so one of them returns
the visibility for the correct repository.
Avoid using async void for Invalidate
This would have crashed Visual Studio if Invalidate had thrown. Moved
async into a separate InvalidateAsync method.

jcansdale and others added some commits Dec 6, 2018

@StanleyGoldman
Copy link
Contributor

StanleyGoldman left a comment

Can you explain what is happening to fall into this trap?

@meaghanlewis meaghanlewis added this to the 2.6.0 milestone Dec 6, 2018

StanleyGoldman added some commits Dec 6, 2018

Merge remote-tracking branch 'remotes/origin/master' into fixes/team-…
…explorer-button-visibility

# Conflicts:
#	src/GitHub.TeamFoundation.14/Home/ForkNavigationItem.cs

@StanleyGoldman StanleyGoldman merged commit d5780f2 into master Dec 6, 2018

0 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor was unable to build non-mergeable pull request
Details
continuous-integration/appveyor/branch Waiting for AppVeyor build to complete
Details

@StanleyGoldman StanleyGoldman deleted the fixes/team-explorer-button-visibility branch Dec 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment