refactor(web): migrate question classifier label hint storage (#36932)

Co-authored-by: lmlm <7487674+popsiclelmlm@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
lmlm
2026-06-02 18:28:50 +08:00
committed by GitHub
parent 8f6b59feff
commit b682591c7a
2 changed files with 4 additions and 22 deletions
-5
View File
@@ -4397,11 +4397,6 @@
"count": 9
}
},
"web/app/components/workflow/nodes/question-classifier/components/class-list.tsx": {
"no-restricted-properties": {
"count": 2
}
},
"web/app/components/workflow/nodes/question-classifier/use-single-run-form-params.ts": {
"ts/no-explicit-any": {
"count": 8
@@ -11,6 +11,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { ReactSortable } from 'react-sortablejs'
import { ArrowDownRoundFill } from '@/app/components/base/icons/src/vender/solid/general'
import { useLocalStorage } from '@/hooks/use-local-storage'
import { useEdgesInteractions } from '../../../hooks'
import AddButton from '../../_base/components/add-button'
import Item from './class-item'
@@ -42,17 +43,8 @@ const ClassList: FC<Props> = ({
const [shouldScrollToEnd, setShouldScrollToEnd] = useState(false)
const prevListLength = useRef(list.length)
const [collapsed, setCollapsed] = useState(false)
const [isRenameHintDismissed, setIsRenameHintDismissed] = useState(() => {
if (typeof window === 'undefined')
return true
try {
return window.localStorage.getItem(INLINE_LABEL_HINT_STORAGE_KEY) === 'true'
}
catch {
return false
}
})
const [storedRenameHintDismissed, setIsRenameHintDismissed] = useLocalStorage<boolean>(INLINE_LABEL_HINT_STORAGE_KEY)
const isRenameHintDismissed = storedRenameHintDismissed ?? false
const handleClassChange = useCallback((index: number) => {
return (value: Topic) => {
@@ -104,12 +96,7 @@ const ClassList: FC<Props> = ({
return
setIsRenameHintDismissed(true)
try {
window.localStorage.setItem(INLINE_LABEL_HINT_STORAGE_KEY, 'true')
}
catch {
}
}, [isRenameHintDismissed])
}, [isRenameHintDismissed, setIsRenameHintDismissed])
const shouldShowRenameHint = !readonly && !isRenameHintDismissed && list.some((item, index) => {
return isDefaultClassLabel(item.label, index + 1, t)