Skip to content

Display Internet Connection Error inside Clone Repository Dialog - #6297

Closed
Daniel-McCarthy wants to merge 5 commits into
desktop:developmentfrom
Daniel-McCarthy:Clone-Repo-No-Internet-Connection-Display
Closed

Daniel-McCarthy wants to merge 5 commits into
desktop:developmentfrom
Daniel-McCarthy:Clone-Repo-No-Internet-Connection-Display

Conversation

@Daniel-McCarthy

@Daniel-McCarthy Daniel-McCarthy commented Nov 27, 2018 •

Copy link
Copy Markdown
Member

Overview

Closes #2796

❗️ #6278 should be merged before this one gets merged because there will likely be some conflicting things ❗️

Description

  • Renders an internet connection error when repositories fail to load in the Clone Repository dialog.
    Additionally, a "Try again?" button has been added to allow the user to initiate an attempt to reload the repositories.

Before:
image

After:
image


Regarding the implementation of these changes, one part I would consider changing but did not initially:
When the Clone Repository dialog attempts to load the repositories, it calls api.fetchRepositories(). This function returns null when it encounters an error, and logs the error. So the caller can detect when loading the repositories failed due to an error, but not which error caused it. Therefore the current implementation can potentially display this "No internet connection" error when it fails due to a different issue.

If this api function instead returned an error code instead of null we could then make it only display the internet connection error when it is confirmed to be an internet issue. However, there may be another way to check this that I am not aware of.

Release notes

Notes: An error will now display in the Clone Repository dialog when internet connection issues occur.

"No internet connection." is now displayed instead of the repositories list if the loading the repositories fails.

It also includes a "Try again?" button that allows manually initiating a repository re-load and render.
@billygriffin

Copy link
Copy Markdown
Contributor

@Daniel-McCarthy 🎉 ❤️ Can I go ahead and add ready-for-review here?

@Daniel-McCarthy

Copy link
Copy Markdown
Member Author

@billygriffin Yes, that would be great! It's ready for the first round of review.

@billygriffin billygriffin added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Nov 27, 2018
@billygriffin
billygriffin requested review from a team November 27, 2018 20:39
@tierninho

Copy link
Copy Markdown
Contributor

Tested the UI changes, and LGTM!

@outofambit
outofambit self-requested a review November 28, 2018 01:18
@iAmWillShepherd iAmWillShepherd self-assigned this Nov 30, 2018
@iAmWillShepherd

Copy link
Copy Markdown
Contributor

@Daniel-McCarthy these are the 3 types of errors we'd get back from the API. We could open an issue to create a new IAPIError interface and update our API functions to return either a Promise or the new type. Doing this will give us a bit more control of how we handle exceptional behavior.

Let me know if you think that would be beneficial for this PR.

cc @desktop/engineering for thoughts on whether we should return an APIResult (made up name since each function returns a different type) or APIError instead of APIResult or null.

When loadRepositories(this.props.account) is called a render will occur, allowing the repository list to refresh and display the newly loaded repositories.

Therefore this.renderRepositoryList() is not necessary and can be removed.
@billygriffin

Copy link
Copy Markdown
Contributor

cc: @niik on this one as well as it touches the cloning dialog.

@billygriffin

Copy link
Copy Markdown
Contributor

Just updated the original issue body, but unfortunately this PR conflicts somewhat with #6278 so we're going to get that one landed first, and then pull this in afterward.

@Daniel-McCarthy

Copy link
Copy Markdown
Member Author

unfortunately this PR conflicts somewhat with #6278 so we're going to get that one landed first, and then pull this in afterward.

Sounds great. I'm more than happy to handle the merge conflicts on my end as soon as that PR gets merged.


these are the 3 types of errors we'd get back from the API. We could open an issue to create a new IAPIError interface and update our API functions to return either a Promise or the new type. Doing this will give us a bit more control of how we handle exceptional behavior.

Let me know if you think that would be beneficial for this PR.

I'm not sure it would be vital for this pull request. I figured if there are other potential causes that would be useful to differentiate from for the user then it might be worth considering here.

Depending on the information we can pass down we would potentially be able display a different error if the user's internet connection doesn't seem to be the problem. But I am not sure if the information we would get from the 3 client errors cover potential issues the user would want to know about.

Even if the issue is not their connection, the "Try Again?" button this new display provides is still very useful to the user as they will want to attempt to refresh regardless of the cause.

And thank you for sharing that information, it was very useful to read through.

@iAmWillShepherd iAmWillShepherd added this to the 1.6.0 milestone Dec 4, 2018
@tierninho tierninho mentioned this pull request Dec 7, 2018
3 tasks done
@Daniel-McCarthy

Copy link
Copy Markdown
Member Author

@billygriffin @niik
Previously we had agreed to wait until #6278 was merged, then handle the merge conflicts here.
However, it appears that the conflicts are greater than expected. This pull request has some conflicting functionality with #6278.

This pull request uses the result of a api.fetchRepositories call to determine whether or not to display the internet connection warning. The changes made in #6278 use the same result to display that it is loading.

I'm not sure if there's a way we can decide which to show depending on the scenario, or if we would have to keep it how it is or substitute the loading display.

@billygriffin

Copy link
Copy Markdown
Contributor

@Daniel-McCarthy Unfortunately I can't speak to the underlying technical tradeoff on this, so I'll have to defer to @niik or someone else in @desktop/engineering to weigh in. Thanks for succinctly explaining where the two are intersecting.

@shiftkey
shiftkey dismissed iAmWillShepherd’s stale review December 19, 2018 14:36

Conflicts and design questions outstanding

@outofambit
outofambit changed the base branch from master to development December 27, 2018 21:48
@shiftkey shiftkey removed this from the 1.6.0 milestone Jan 9, 2019
@shiftkey

shiftkey commented Jan 9, 2019

Copy link
Copy Markdown
Member

Dropping this from 1.6.0 while it needs some changes and discussion

Since the creation of these commits there have been some radical changes to the clone-repository set ofdialogs and classes.

Since some of the areas that this code touches no longer exist it would be easiest to remove the changes before merging and starting over after the merge.
Previously if a list of repositories could not be loaded for a user it always say "Couldn't find any repositories" for that account.

This may imply to the user they may not have any repositories.

However, this may also be due to not having an internet connection when attempting to clone.

Therefore if the user is connected to a network then they will be shown the "Could not find any repositories" dialog. Otherwise they will see a new "No internet connection" warning which includes a link to refresh.
@Daniel-McCarthy

Copy link
Copy Markdown
Member Author

I have looked into this further and was able to find a way to potentially reconcile the issue with the two displays that would potentially be shown if no repositories were loaded.

Currently if one goes to the Clone Repository dialog in the GitHub section and no repositories are loaded for the list it will show a display saying that no repositories could be found for the account and offering a link to attempt to refresh. (This has been added since the creation of this pull request.)

Shown here:
image

However, it does not imply any issues with internet connection, rather that the account itself has been checked for repositories.

I mentioned prior that there were potential issues regarding detecting whether or not the user has an internet connection. I have updated this by checking the navigator.onLine property. For Chrome it will return false if the user is not connected to a network. However, it is not a perfect indicator.

Essentially with the current updated implementation it will always show the above display unless they are not connected to another network. If they are not connected to a network it will display the original display design warning of no internet connection and offering a link to attempt to refresh, as seen here:

image

navigator.onLine may be sufficient for deciding which display to show. If there is a more reliable way to check for connection that would be preferred we could try that.

Additionally we can decide if this display is still wanted, given that there have been noticeable changes since the creation of the original issue.

@say25 say25 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - minimally invasive

@iAmWillShepherd iAmWillShepherd added the design-input-needed Issues that require design input from the core team before the work can be started label Feb 19, 2019
@iAmWillShepherd iAmWillShepherd removed the design-input-needed Issues that require design input from the core team before the work can be started label Feb 19, 2019
@iAmWillShepherd

iAmWillShepherd commented Feb 19, 2019 •

Copy link
Copy Markdown
Contributor

We think that using the navigator.onLine property is a good start to this solution, but we are concerned about its limitation to tell us whether there is internet access (see docs here). At the moment, this property only tells us if the user is connected to a (W)LAN, not if they have internet connection e.g., if I connect to my router that has no connection to the internet, the app will think that I have an internet connection when I don't.

We think you can check for this error to know for sure if there is internet access
screen shot 2019-02-19 at 4 21 23 pm

@Daniel-McCarthy

Copy link
Copy Markdown
Member Author

@iAmWillShepherd Okay, sounds good. I'd like to get a better idea of the proposed changes here.

  • In order for the function renderNoItems in cloneable-repository-filter-list to detect this ERR_INTERNET_DISCONNECTED Error it needs that information passed in as a prop alongside the repositories prop.

  • To pass a boolean showing the error was thrown to cloneable-repository-filter-list as a prop, blank-slate.tsx and clone-github-repository.tsx would need to pass the information in from the IAccountRepositories account state.

  • Then api-repositories-store.tsx needs to store the information after a calling api.fetchRepositories() where it gets the repositories prop that gets passed all the way down.

  • In api.ts the fetchRepositories function does log.warn() with the error and returns null.
    In order to make this work via the above changes, this function would have to return an Error type instead of null.


I'd like to be sure this is the set of changes we would need, or if there's a different way to access this information from the renderNoItems function that you had in mind?

Thanks for your time!

@iAmWillShepherd

iAmWillShepherd commented Feb 21, 2019 •

Copy link
Copy Markdown
Contributor

I think it'd be best to seperate this PR into two distinct solutions:

  1. Display a better error message to the user
  2. Figuring out when a user is connected to the internet

Since option 2 is relatively hard and has implications outside of the clone dialog, I think starting with addressing the error dialog will give us a good starting off point to potentially solve the connectivity problem.

Solving that may also address #1128 - there is a conversation here discussing an offline mode for the app.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor

I spotted an interactions that could use some refinement.

Black - Development version
White - Production version

2019-02-21 14 41 43

When connection is lost and re-gained, the component does not know this, forcing me to have to click the refresh button (You get the message saying "Couldn't find any repositories..."). I think this can happen automagically as the current production version of the app does.

@billygriffin

Copy link
Copy Markdown
Contributor

In talking this over with @Daniel-McCarthy, @nerdneha, and @niik, given the complexity here we all decided this probably went a little too far and our efforts (and @Daniel-McCarthy's) might better be prioritized on other things with more of a clear impact. I'm also going to close the associated issue because we haven't really heard this feedback from users as representing a real problem affecting more than a couple folks.

@Daniel-McCarthy Huge thanks for your efforts here and apologies we weren't as clear on the impact here as we could've been, and I'm excited to see what you work on next! 😄

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

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants