Besides the problem related in the isseu 155 I also realized that whenever we would reload and item page it would display the message as if that item was unavailable. To fix this I created a state to know if it was the first time the useEffect in which we check if the item is available ran. This state variable is placed in line 150 as follow:
Resolves #155
Besides the problem related in the isseu 155 I also realized that whenever we would reload and
item
page it would display the message as if that item was unavailable. To fix this I created a state to know if it was the first time theuseEffect
in which we check if the item is available ran. This state variable is placed in line 150 as follow:const [isUseEffectSecondLoad, setIsUseEffectSecondLoad] = useState(false)
From line 154 to 158 is where the
useEffect
runs as follow:This avoid the unavailable message right after the page is loaded and is only displayed when the item is indeed unavailable.