Skip to content

Commit 5980c49

Browse files
committed
Revert "Update CartProvider.tsx"
This reverts commit 446ff96.
1 parent 446ff96 commit 5980c49

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/stores/CartProvider.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,12 @@ interface ICartContext {
5151
cart: RootObject | null | undefined;
5252
setCart: React.Dispatch<React.SetStateAction<TRootObjectNull>>;
5353
updateCart: (newCart: RootObject) => void;
54-
isLoading: boolean;
5554
}
5655

5756
const CartState: ICartContext = {
5857
cart: null,
5958
setCart: () => {},
6059
updateCart: () => {},
61-
isLoading: true,
6260
};
6361

6462
export const CartContext = createContext<ICartContext>(CartState);
@@ -68,7 +66,6 @@ export const CartContext = createContext<ICartContext>(CartState);
6866
*/
6967
export const CartProvider = ({ children }: ICartProviderProps) => {
7068
const [cart, setCart] = useState<RootObject | null>();
71-
const [isLoading, setIsLoading] = useState(true);
7269

7370
useEffect(() => {
7471
// Check if we are client-side before we access the localStorage
@@ -78,7 +75,6 @@ export const CartProvider = ({ children }: ICartProviderProps) => {
7875
const cartData: RootObject = JSON.parse(localCartData);
7976
setCart(cartData);
8077
}
81-
setIsLoading(false);
8278
}
8379
}, []);
8480

@@ -90,8 +86,8 @@ export const CartProvider = ({ children }: ICartProviderProps) => {
9086
};
9187

9288
const contextValue = useMemo(() => {
93-
return { cart, setCart, updateCart, isLoading };
94-
}, [cart, isLoading]);
89+
return { cart, setCart, updateCart };
90+
}, [cart]);
9591

9692
return (
9793
<CartContext.Provider value={contextValue}>

0 commit comments

Comments
 (0)