Skip to content
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

Fix(Invetory): adding loading indicator into the inventory list #1991

Merged

Conversation

jeremielodi
Copy link
Collaborator

This PR helps to add a loading indicator to the inventory list

Copy link
Contributor

@jniles jniles left a comment

Choose a reason for hiding this comment

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

@jeremielodi, this is a good first attempt. The component is exactly what the issue asked for! 👍

Unfortunately, this will never show - the loading indicator should turn on, wait for the data to load, and turn off. You can test this by setting the network tab in your chrome developer tools to us 'slow 3G' connections. The correct way to turn off the loading is shown above - either when the server has sent the data or an error.

Additionally, the handle error method should be renamed to make sure you don't break JS's error class.

.catch(Notify.handleError);
.catch(Error);

vm.loading = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the loading indicator work? It seems like this will not wait for the data to download.

The correct way to wait for the data to download is to use the .finally() Promise method. Like this:

.catch(Notify.handleError)
.finally(function () {
  vm.loading = false; // this will execute after the data is downloaded.
});

}

function Error() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Error is a reserved word in JavaScript. Could you name this function something else?

}

function Error() {
vm.hasError = true;
Notify.handleError();
Copy link
Contributor

Choose a reason for hiding this comment

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

Notify.handleError() takes in a parameter - the error sent from the server. It should be passed to thus function.

@jniles
Copy link
Contributor

jniles commented Aug 16, 2017

It would also be good to put "fixes #" and reference the issue so that this closes the issue when merged....

@jniles
Copy link
Contributor

jniles commented Aug 17, 2017

@jeremielodi, let me know when you ready for another review.

Copy link
Contributor

@jniles jniles left a comment

Choose a reason for hiding this comment

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

LGTM.

@jniles jniles merged commit 360b68a into IMA-WorldHealth:master Aug 17, 2017
@jeremielodi jeremielodi deleted the loading_indicator_into_inveroty_list branch October 1, 2021 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants