Repository navigation
auto recover missing repository - #6228
Conversation
Daniel-McCarthy
left a comment
There was a problem hiding this comment.
Hi there, thanks for working on a solution for this Issue!
I see you have this set up to auto-recover on a timer interval. One idea I wanted to float by was potentially attempt to auto-recover on window focus, since the user may leave GitHub Desktop to make a change and then return to the GitHub Desktop window to check the status.
I am leaving this as a comment since I wanted to see what you and others thought about this idea. And for an example of such functionality within GitHub Desktop, here is a commit that adds a listener for focus.
|
@Daniel-McCarthy, Thanks for the feedback. I got to noticing that the 'MissingRepository' happens after a window focus event. Also, it was seeming like the auto recovery was kicking in on a window focus event as well, but in reality it was on any user activity, such as mousing between menus, and I thought that level of triggering the GIT process to detect the return of the repository shouldn't happen, and so changed it to only perform the check after the time delay, instead of before it. I've followed through the code and determined how the window focus event triggers the detection of the missing repository, and the detection is done first most with Now, more on the window focus event. This means there is already a window focus event in 'index.tsx'. It currently calls to refresh the repository if the selected repository is not already in the missing state. I could see this whole process being changed so that On a further note regarding window focus. It seems common place today for users to consider all events in the system to be interconnected. Thus, if I delete or rename a folder in Explorer, I tend to expect (only though examples all around) that GitHub Desktop might see that immediately. Programmers may be aware of the actual complexity that this interconnected appearance requires (file watchers, etc...) but common users just expect it to be. |
outofambit
left a comment
There was a problem hiding this comment.
Hi again @msftrncs and thanks so much for this PR! :) I'm inclined to agree with @Daniel-McCarthy's suggestion and your proposal to use _refreshRepository to trigger this check. Perhaps AutoRecovery could become a method on AppStore that gets called from there? I think attempting to handle this case as its detected would be amazing! 🌟
|
I have altered my idea slightly, on
However, the code probably does belong in These changes more follow the current design of the app. |
|
I missed that selecting a missing repository should probably also attempt to recover the repository, and have included a commit to cover that as well. The approach in 'app-store.ts' (AppStore) |
changes made, now pending design input
|
@msftrncs I have also had to do this recently and hit the same road block. I found that a place in the code base that does this is the About dialog. To accomplish it, they stored the desktop/app/src/ui/about/about.tsx Lines 248 to 250 in 073b456 Then, they embedded the variable with desktop/app/src/ui/about/about.tsx Lines 271 to 272 in 073b456 This is how I ended up doing it as well as I was not able to find another way to get the space to show up as expected. |
|
@Daniel-McCarthy, I guess there is a space there. I went back and took the space out, and its a big difference, its just that there doesn't appear to be much space there, until there is none there at all. desktop/app/src/ui/missing-repository.tsx Lines 54 to 56 in 06d096c I used |
|
desktop/app/src/lib/stores/app-store.ts Lines 1898 to 1909 in 06d096c desktop/app/src/lib/dispatcher/dispatcher.ts Lines 248 to 252 in 06d096c Would there be any value in changing (App-Store) |
|
I just want to mention a thought I have for UI reaction to the 'Check again' concept. Without any reaction, the user would think nothing is happening. My thought would be to change the text, from 'Check again' to 'Checking...' for a small period of time, the maximum of which would be some constant period of time (0.5 to 1 second maybe) via a timer, or the length of time it takes to complete, unsuccessfully, the repository recovery tests. |
|
Seems reasonable to me @msftrncs, always have ❤️ for feedback to users on what's taking place. 😄 |
|
This looks great @msftrncs, thanks so much for making that change! Would it be possible to center align the text as well? |
|
@ampinsk, I too noticed the uncentered appearance, but I think centering the text 'It was last seen at "{path}". Check again.' might result in a small side affect. When the text is wrapped, both the first line and each of the continuing wrapped line(s) will be separately centered. I'll check this out and see what it looks like. |
i like this idea a lot! good call on moving logic out of dispatcher into app-store. 👍 |
|
@ampinsk, here is what it could look like center aligned. |
|
@msftrncs that looks great, thank you! |
|
@msftrncs Ooh sorry, a couple things I didn't notice before:
cc @outofambit |
|
@ampinsk, @outofambit, sorry, I had left the button Check Again along with the textlink 'Check again.' for evaluation. This particular repository that is shown in my image isn't a GitHub repo, so the 'Clone Again' button is not shown. Also, the centering of the text was not included in my most recent commit, nor was any attempt to provide a UI reaction to clicking the textlink. I can get the first time items commited later this evening, and I can work on the reaction part in a later PR if that it desired. |
DescriptionRestores access to a known repository that has been marked missing, if the repository is restored to its original location:
|
|
The UI was tested for this change, and overall it functions well.
Notes:
Build/OS: 1.5.1-beta1, mac, 549e6ce |
By chance does this go away if you 'select' that repository (after having a different one selected) ?? I noticed some code in the selection handler clears the GIT cache (for the repository) if the repository is missing when its selected, but this doesn't seem to happen at any other time. EDIT: I have confirmed that the process of selecting a repository has no effect on the 'up' or 'down' arrows shown in the repository list on missing repositories. Instead I noticed that those status icons are only shown if the repository was able to be found and refreshed during the current execution run. |
@msftrncs Thanks for confirming above. The icon does go away after moving the repo to another location, clicking the Clone Again button, dismissing the error, and then reopening the repo list. Not a good use case, but might offer a clue to fixing it. 💭 |
|
Assigning myself to also review this because this all happened while I was out on leave last month and I just now noticed it's planned for |
| */ | ||
| if ( | ||
| repository.missing | ||
| ? (await pathExists(repository.path)) |
There was a problem hiding this comment.
🎨 I'm not a huge fan of the readability of this nested ternary with multiple await-s inside an if statement. I had a go at getting these same rules down in a way that's hopefully easier to understand and makes the large code comment less important. Happy to get this into a follow-up PR:
private async recoverMissingRepository(
repository: Repository
): Promise<Repository> {
if (!repository.missing) {
return repository
}
// if the repository is marked missing, check to see if the file path exists,
// and if so then see if git recognizes the path as a valid repository,
// and if so, reset the missing status as its been restored
const exists = await pathExists(repository.path)
if (exists) {
const isGitRepo = await isGitRepository(repository.path)
if (isGitRepo) {
return this._updateRepositoryMissing(repository, false)
}
}
// otherwise just return the original repository
return repository
}|
Looks good from the design side! |
|
Awesome! 🎉 Thanks for your work on this @msftrncs!! |







Overview
Addresses issues #4264, #5734. Attempts to recover the repository where it was last known to be, automatically.
Description
Updates to 'missing-repository' to trigger a rechecking of the repository state after a delay, and repetitively with a delay while the repository remains in the missing state. Technically every action the user performs while the missing repository view is up, triggers a rechecking of the repository, after a delay.
Release notes
Notes:
On a network environment, some operations may become hesitant depending on the order of events or something.