Skip to content

Commit ad5f6f9

Browse files
committed
fix: 修复 lint 错误 - useCallback 依赖和未使用变量
1 parent c07fca6 commit ad5f6f9

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/components/ProblemList/PathView/TreasureNode.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ const TreasureNode: React.FC<TreasureNodeProps> = ({
9494
};
9595

9696
// 获取随机祝福语
97-
const getRandomBlessing = () => {
97+
const getRandomBlessing = useCallback(() => {
9898
const blessings = currentLang === 'zh' ? BLESSING_ZH : BLESSING_EN;
9999
return blessings[Math.floor(Math.random() * blessings.length)];
100-
};
100+
}, [currentLang]);
101101

102102
// 加载宝箱状态
103103
useEffect(() => {
@@ -145,7 +145,7 @@ const TreasureNode: React.FC<TreasureNodeProps> = ({
145145
console.error('开启宝箱失败:', error);
146146
setIsOpening(false);
147147
}
148-
}, [canOpen, isOpened, isOpening, treasureId, onOpen, currentLang]);
148+
}, [canOpen, isOpened, isOpening, treasureId, onOpen, getRandomBlessing]);
149149

150150
// 确定宝箱状态类名
151151
const getStatusClass = () => {

src/components/ProblemList/hooks/useCompletionStatus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState, useEffect, useCallback } from 'react';
22
import { completionStorage, CompletionRecord } from '../../../services/completionStorage';
3-
import { experienceStorage, DIFFICULTY_EXP, ExperienceRecord, TREASURE_EXP } from '../../../services/experienceStorage';
3+
import { experienceStorage, DIFFICULTY_EXP, ExperienceRecord } from '../../../services/experienceStorage';
44

55
interface CompletionStats {
66
total: number;

src/data/animation-list.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"generatedAt": "2026-01-05T15:26:54.437Z",
2+
"generatedAt": "2026-01-05T16:10:33.153Z",
33
"count": 2,
44
"animations": {
55
"46": {

0 commit comments

Comments
 (0)