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

@@ -26,7 +26,7 @@ export default function Product() {
const [selectedAttributes, setSelectedAttributes] = useState<Record<string, string>>({});
const thumbnailsRef = useRef<HTMLDivElement>(null);
const { addItem } = useCartStore();
const { isEnabled: wishlistEnabled, isInWishlist, toggleWishlist, isLoggedIn } = useWishlist();
const { isEnabled: wishlistEnabled, isInWishlist, toggleWishlist } = useWishlist();
const { isEnabled: isModuleEnabled } = useModules();
// Apply white background to <main> in flat mode so the full viewport width is white
@@ -86,6 +86,7 @@ export default function Product() {
if (product && !selectedImage) {
setSelectedImage(product.image || product.images?.[0]);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [product]);
// AUTO-SELECT FIRST VARIATION (Issue #2 from report)
@@ -103,6 +104,7 @@ export default function Product() {
setSelectedAttributes(initialAttributes);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [product]);
// Find matching variation when attributes change
@@ -114,7 +116,6 @@ export default function Product() {
(product.variations as any[]).forEach(v => {
if (!v.attributes) return;
let isMatch = true;
let score = 0;
const attributesMatch = Object.entries(selectedAttributes).every(([attrName, attrValue]) => {
@@ -230,7 +231,7 @@ export default function Product() {
// Construct variation params using keys from the matched variation
// but filling in values from user selection (handles "Any" variations with empty values)
let variation_params: Record<string, string> = {};
const variation_params: Record<string, string> = {};
if (product.type === 'variable' && selectedVariation?.attributes) {
// Get keys from the variation's attributes (these are the correct WooCommerce keys)
Object.keys(selectedVariation.attributes).forEach(key => {