summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2017-10-24 13:55:26 -0400
committerWes Bos <wesbos@gmail.com>2017-10-24 13:55:26 -0400
commit6f44adb59d3542eb21e55e0aae789b1fcc7cf8f1 (patch)
treefd7ec721529a2ebb37aa37d33be32ad5c88a13b8 /components
parent3b45dd7b593825721ec9ee9f6a49c732601b1ae0 (diff)
add to cart
Diffstat (limited to 'components')
-rw-r--r--components/AddToCart.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/components/AddToCart.js b/components/AddToCart.js
index 9bcdb7f..ae5b87f 100644
--- a/components/AddToCart.js
+++ b/components/AddToCart.js
@@ -62,8 +62,7 @@ class AddToCart extends Component {
render() {
const user = this.props.currentUserQuery.user;
-
- if (!user) return <p>Loading...</p>;
+ if (!user || this.props.singleItemQuery.loading) return <p>Loading...</p>;
const cartIds = user.cart.map(item => item.id);
const image = this.props.singleItemQuery.Item.image;
const isInCart = cartIds.includes(this.props.id);