fix: resolve all 15 frontend ESLint errors for green CI
- Replace setState-in-effect with state-based tracking (AdminLayout, EditCategoryModal) - Convert inline SortIcon component to getSortIcon function (TreeTableView) - Remove unused catch parameters (CreateCategoryModal, EditCategoryModal) - Replace `any` types with proper types (SessionFilters, AdminCategoriesPage, SessionHistoryPage) - Fix unused destructuring variable (StepRatingModal) - Fix constant binary expression in test (utils.test.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useState } from 'react'
|
||||
import { X } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { StepCategoryListItem } from '@/types'
|
||||
@@ -21,14 +21,17 @@ export function EditCategoryModal({
|
||||
const [name, setName] = useState('')
|
||||
const [description, setDescription] = useState('')
|
||||
const [error, setError] = useState('')
|
||||
const [prevCategoryId, setPrevCategoryId] = useState<string | null>(null)
|
||||
|
||||
// Pre-populate form when category changes
|
||||
useEffect(() => {
|
||||
if (category) {
|
||||
setName(category.name)
|
||||
setDescription(category.description || '')
|
||||
}
|
||||
}, [category])
|
||||
// Pre-populate form when category changes (state-based tracking)
|
||||
if (category && category.id !== prevCategoryId) {
|
||||
setPrevCategoryId(category.id)
|
||||
setName(category.name)
|
||||
setDescription(category.description || '')
|
||||
}
|
||||
if (!category && prevCategoryId !== null) {
|
||||
setPrevCategoryId(null)
|
||||
}
|
||||
|
||||
if (!isOpen || !category) return null
|
||||
|
||||
@@ -51,7 +54,7 @@ export function EditCategoryModal({
|
||||
name: name.trim(),
|
||||
description: description.trim()
|
||||
})
|
||||
} catch (err) {
|
||||
} catch {
|
||||
setError('Failed to update category')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user