Fix IDE errors from ESLint cleanup
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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>) => {
|
||||
|
||||
Reference in New Issue
Block a user