diff --git a/src/components/header.js b/src/components/header.js
index 2d236bd..64fcf79 100644
--- a/src/components/header.js
+++ b/src/components/header.js
@@ -21,7 +21,7 @@ const Header = ({ location }) => {
const [state, dispatch] = useContext(CartContext)
const [miscState, miscDispatch] = useContext(MiscContext)
- console.log(location)
+ // console.log(location)
const getActiveSidebar = () => location.state?.activeSidebar
diff --git a/src/components/product/productBase.js b/src/components/product/productBase.js
index 4f62faf..814d5c4 100644
--- a/src/components/product/productBase.js
+++ b/src/components/product/productBase.js
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from "react"
import Button from "../button"
import AsInputNumber from "../inputNumber"
+import useHasMountedAndHasValue from "../useHasMountedAndHasValue"
import { round } from "../../utils"
const AddButton = (props) => {
@@ -87,6 +88,11 @@ const ProductBase = (props) => {
data.price = round(data.price)
const [count, setCount] = useState(countInCart || 1)
+ // Two-pass rendering technique, see:
+ // https://github.com/gatsbyjs/gatsby/issues/17914
+ // https://joshwcomeau.com/react/the-perils-of-rehydration/
+ const hasMountedAndHasValue = useHasMountedAndHasValue(countInCart)
+
useEffect(() => {
if (countInCart) setCount(countInCart)
}, [countInCart])
@@ -99,6 +105,7 @@ const ProductBase = (props) => {
countInCart,
ToggleButton,
InputNumber,
+ hasMountedAndHasValue,
}
return