Fix IDE errors from ESLint cleanup

This commit is contained in:
Dwindi Ramadhana
2026-03-12 04:08:57 +07:00
parent 90169b508d
commit ab10c25c28
34 changed files with 155 additions and 258 deletions

View File

@@ -66,7 +66,8 @@ export function useAddToCartFromUrl() {
// Remove from processed set on error so it can be retried
processedRef.current.delete(requestKey);
});
}, [location.hash, navigate, setCart]); // Include all dependencies
}, [location.hash, location.pathname, navigate, setCart]); // Include all dependencies
}
async function addToCart(

View File

@@ -1,4 +1,4 @@
import { useState, useEffect, useCallback, useMemo } from 'react';
import { useState, useCallback, useMemo } from 'react';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { api } from '@/lib/api/client';
import { toast } from 'sonner';
@@ -21,27 +21,25 @@ const GUEST_WISHLIST_KEY = 'woonoow_guest_wishlist';
export function useWishlist() {
const queryClient = useQueryClient();
const [guestIds, setGuestIds] = useState<Set<number>>(new Set());
// Check if wishlist is enabled (default true if not explicitly set to false)
const settings = (window as any).woonoowCustomer?.settings;
const isEnabled = settings?.wishlist_enabled !== false;
const isLoggedIn = (window as any).woonoowCustomer?.user?.isLoggedIn;
// Load guest wishlist on mount
useEffect(() => {
if (!isLoggedIn) {
const [guestIds, setGuestIds] = useState<Set<number>>(() => {
if (typeof window !== 'undefined' && !(window as any).woonoowCustomer?.user?.isLoggedIn) {
try {
const stored = localStorage.getItem(GUEST_WISHLIST_KEY);
if (stored) {
const ids = JSON.parse(stored) as number[];
setGuestIds(new Set(ids));
return new Set(ids);
}
} catch (error) {
console.error('Failed to load guest wishlist:', error);
}
}
}, [isLoggedIn]);
return new Set<number>();
});
// Check if wishlist is enabled (default true if not explicitly set to false)
const settings = (window as any).woonoowCustomer?.settings;
const isEnabled = settings?.wishlist_enabled !== false;
const isLoggedIn = (window as any).woonoowCustomer?.user?.isLoggedIn;
// Save guest wishlist helper
const saveGuestWishlist = useCallback((ids: Set<number>) => {