From 3f992f62c54e09254c48d653c2cd138df1cbd8e2 Mon Sep 17 00:00:00 2001
From: Miqdad <ahmadmiqdad27@gmail.com>
Date: Sat, 31 May 2025 14:33:24 +0700
Subject: <miqdad> fix error deployment

---
 src-migrate/modules/cart/components/ItemSelect.tsx | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

(limited to 'src-migrate/modules/cart/components/ItemSelect.tsx')

diff --git a/src-migrate/modules/cart/components/ItemSelect.tsx b/src-migrate/modules/cart/components/ItemSelect.tsx
index 72ab49aa..f95ee36c 100644
--- a/src-migrate/modules/cart/components/ItemSelect.tsx
+++ b/src-migrate/modules/cart/components/ItemSelect.tsx
@@ -11,11 +11,11 @@ import {
   checkboxUpdateState,
 } from '~/utils/cart';
 
-type Props = {
+interface Props {
   item: CartItem;
-};
+}
 
-const CartItemSelect = ({ item }: Props) => {
+const CartItemSelect: React.FC<Props> = ({ item }) => {
   const auth = getAuth();
   const { updateCartItem, cart, loadCart } = useCartStore();
   const [isUpdating, setIsUpdating] = useState<boolean>(false);
@@ -23,7 +23,7 @@ const CartItemSelect = ({ item }: Props) => {
 
   // Subscribe to global checkbox update state
   useEffect(() => {
-    const handleUpdateStateChange = (isUpdating) => {
+    const handleUpdateStateChange = (isUpdating: boolean): void => {
       // This component doesn't need to react to global state changes
       // Individual checkboxes are managed independently
     };
@@ -36,7 +36,10 @@ const CartItemSelect = ({ item }: Props) => {
   useEffect(() => {
     if (isUpdating) return;
 
-    const selectedItems = getSelectedItemsFromCookie();
+    const selectedItems = getSelectedItemsFromCookie() as Record<
+      number,
+      boolean
+    >;
     const storedState = selectedItems[item.id];
 
     if (storedState !== undefined) {
@@ -62,7 +65,7 @@ const CartItemSelect = ({ item }: Props) => {
   }, [item.id, item.selected, localSelected, cart, updateCartItem, isUpdating]);
 
   const handleChange = useCallback(
-    async (e: React.ChangeEvent<HTMLInputElement>) => {
+    async (e: React.ChangeEvent<HTMLInputElement>): Promise<void> => {
       if (typeof auth !== 'object' || !cart || isUpdating) return;
 
       const newSelectedState = e.target.checked;
@@ -70,7 +73,7 @@ const CartItemSelect = ({ item }: Props) => {
       // Update local state immediately
       setLocalSelected(newSelectedState);
       setIsUpdating(true);
-      checkboxUpdateState.startUpdate(item.id);
+      checkboxUpdateState.startUpdate();
 
       try {
         // Update cookie immediately for responsive UI
@@ -107,14 +110,13 @@ const CartItemSelect = ({ item }: Props) => {
         loadCart(auth.id);
       } finally {
         setIsUpdating(false);
-        checkboxUpdateState.endUpdate(item.id);
+        checkboxUpdateState.endUpdate();
       }
     },
     [auth, cart, item, isUpdating, updateCartItem, loadCart]
   );
 
-  const isDisabled =
-    isUpdating || checkboxUpdateState.isCheckboxUpdating(item.id);
+  const isDisabled: boolean = isUpdating;
 
   return (
     <div className='w-6 my-auto relative'>
-- 
cgit v1.2.3

