mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 15:09:20 +00:00
fix(ui): resolve Cannot access 'displayItem' before initialization ReferenceError
Use item.id directly since it is available at the start of the component from props.
This commit is contained in:
@@ -84,7 +84,7 @@ export function FileCard({
|
||||
const [name, setName] = useState(item.name)
|
||||
const inputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
const fileUploadState = useUploadStore((state) => state.fileProgress[displayItem.id || ''])
|
||||
const fileUploadState = useUploadStore((state) => state.fileProgress[item.id || ''])
|
||||
const uploadPercent = fileUploadState
|
||||
? fileUploadState.total > 0
|
||||
? (fileUploadState.loaded / fileUploadState.total) * 100
|
||||
|
||||
@@ -62,7 +62,7 @@ export function FileListItem({
|
||||
const [name, setName] = useState(item.name)
|
||||
const inputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
const fileUploadState = useUploadStore((state) => state.fileProgress[displayItem.id || ''])
|
||||
const fileUploadState = useUploadStore((state) => state.fileProgress[item.id || ''])
|
||||
const uploadPercent = fileUploadState
|
||||
? fileUploadState.total > 0
|
||||
? (fileUploadState.loaded / fileUploadState.total) * 100
|
||||
|
||||
Reference in New Issue
Block a user