Skip to content
This repository has been archived by the owner on Jun 11, 2020. It is now read-only.

Properly show spinner when user has no repositories #516

Merged
merged 1 commit into from
Mar 17, 2017

Conversation

bartaz
Copy link
Contributor

@bartaz bartaz commented Mar 17, 2017

Fixes #507

Showing spinner on 'My repos' until snaps data is properly fetched.
If user has no repos (because they never added one or removed all of them) they will be redirected to select repositories.

Current solution has one case when it works a bit weird (may be considered a bug):
When user has some repositories and adds new one, then they move back from 'select repositories' to 'my repositories' they will see their old list of repos (without the new one) until list gets refreshed.
There is also no spinner of any kind (because we don't want to show spinner during polling).
So there is a visual delay between adding a repo and it being rendered no the list.

const snapsLength = nextProps.snaps.snaps && nextProps.snaps.snaps.length;

if ((this.props.snaps.success !== nextProps.snaps.success)
|| (snapsLength === 0)) {
Copy link
Contributor Author

@bartaz bartaz Mar 17, 2017

Choose a reason for hiding this comment

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

Making sure user is redirected to select repositories view when all snaps are removed.

//
// when snaps are loaded and user doesn't have any, they will be redirected
// to select repositories (so spinner won't be showing endlessly)
return !hasSnaps
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In case of 'My repos' we don't care about isFetching or success.

If we don't know if user has any repos (initial state) we show spinner.
If we know they don't have any, we redirect to select repositories.

Otherwise we render repositories list. There is no spinner shown during polling.

@bartaz bartaz merged commit 3af1f4b into master Mar 17, 2017
@bartaz bartaz deleted the 507-fix-my-repos-loading branch March 17, 2017 16:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants