Skip to content

Commit 256bab8

Browse files
author
wenhuxian
committed
优化 Issue 获取逻辑:改为基于活跃版本获取,支持 OTHERS 类别手动管理,修复后台刷新导致详情页图片加载失败的问题,并增强指示器稳定性
1 parent 05a83ba commit 256bab8

File tree

2 files changed

+191
-110
lines changed

2 files changed

+191
-110
lines changed

src/renderer/App.tsx

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ const App: React.FC = () => {
372372
let count = 0;
373373
const sync = () => {
374374
update();
375-
if (count < 15) {
375+
if (count < 30) { // Increased to 30 to handle longer layout shifts
376376
count++;
377377
rafId = requestAnimationFrame(sync);
378378
}
@@ -411,7 +411,7 @@ const App: React.FC = () => {
411411
let count = 0;
412412
const sync = () => {
413413
update();
414-
if (count < 15) {
414+
if (count < 30) { // Increased to 30
415415
count++;
416416
requestAnimationFrame(sync);
417417
}
@@ -420,9 +420,9 @@ const App: React.FC = () => {
420420
}, []);
421421

422422
useEffect(() => {
423-
const timer = setTimeout(updateSidebarIndicator, 10); // Reduced delay for faster response
423+
const timer = setTimeout(updateSidebarIndicator, 10);
424424
return () => clearTimeout(timer);
425-
}, [vm.selectedProjectId, vm.selectedVersionId, expandedProjects, vm.projects, vm.projectVersionsMap, updateSidebarIndicator, windowWidth, sidebarWidth]);
425+
}, [vm.selectedProjectId, vm.selectedVersionId, expandedProjects, vm.projects, vm.projectVersionsMap, vm.activeVersionIds, updateSidebarIndicator, windowWidth, sidebarWidth]);
426426

427427
useEffect(() => {
428428
const handleGlobalClick = (e: MouseEvent) => {
@@ -1264,9 +1264,9 @@ const App: React.FC = () => {
12641264

12651265
{vm.projects.map(p => {
12661266
const versions = vm.projectVersionsMap[p.id] || [];
1267-
// Use initialVersionsWithIssues for stable categorization (doesn't change when fetching Others versions)
1268-
const activeVersions = versions.filter(v => vm.initialVersionsWithIssues.has(v.id));
1269-
const emptyVersions = versions.filter(v => !vm.initialVersionsWithIssues.has(v.id));
1267+
// Use activeVersionIds to determine which versions are active vs in Others
1268+
const activeVersions = versions.filter(v => vm.activeVersionIds.has(v.id));
1269+
const emptyVersions = versions.filter(v => !vm.activeVersionIds.has(v.id));
12701270

12711271
return (
12721272
<div key={p.id}>
@@ -1353,6 +1353,12 @@ const App: React.FC = () => {
13531353
{sc.dev > 0 && <span style={{ color: '#ff453a' }}>{sc.dev}</span>}
13541354
{sc.done > 0 && <span style={{ color: '#30d158' }}>{sc.done}</span>}
13551355
{sc.verified > 0 && <span style={{ color: '#666' }}>{sc.verified}</span>}
1356+
{/* Move to Others button */}
1357+
<span
1358+
onClick={(e) => { e.stopPropagation(); vm.toggleVersionActive(v.id); }}
1359+
style={{ color: 'var(--text-secondary)', fontSize: 11, padding: '0 3px', cursor: 'pointer', opacity: 0.6 }}
1360+
title="移入 Others"
1361+
></span>
13561362
{totalCount === 0 && (
13571363
<span
13581364
onClick={(e) => { e.stopPropagation(); setDeleteVersionConfirm({ projectId: p.id, versionId: v.id, name: v.name }); }}
@@ -1436,13 +1442,21 @@ const App: React.FC = () => {
14361442
</span>
14371443
)}
14381444
</div>
1439-
{(vm.versionIssueCounts[v.id] || 0) === 0 && (
1445+
<span style={{ fontSize: 10, display: 'flex', gap: 4, alignItems: 'center' }}>
1446+
{/* Move out of Others button */}
14401447
<span
1441-
onClick={(e) => { e.stopPropagation(); setDeleteVersionConfirm({ projectId: p.id, versionId: v.id, name: v.name }); }}
1442-
style={{ color: '#ff453a', fontSize: 12, padding: '0 5px', cursor: 'pointer' }}
1443-
title="删除版本"
1444-
>×</span>
1445-
)}
1448+
onClick={(e) => { e.stopPropagation(); vm.toggleVersionActive(v.id); }}
1449+
style={{ color: '#30d158', fontSize: 11, padding: '0 3px', cursor: 'pointer' }}
1450+
title="移出 Others (激活)"
1451+
></span>
1452+
{(vm.versionIssueCounts[v.id] || 0) === 0 && (
1453+
<span
1454+
onClick={(e) => { e.stopPropagation(); setDeleteVersionConfirm({ projectId: p.id, versionId: v.id, name: v.name }); }}
1455+
style={{ color: '#ff453a', fontSize: 12, padding: '0 5px', cursor: 'pointer' }}
1456+
title="删除版本"
1457+
>×</span>
1458+
)}
1459+
</span>
14461460
</div>
14471461
);
14481462
})}

0 commit comments

Comments
 (0)