fix: openActivityTarget now loads fileItems before showing Files tab

selectNode() resets fileItems=[] and activeTab='overview'. Setting
activeTab='files' programmatically does not trigger the tab click
handler that calls loadFolder(), so the file tree stays empty.

Fix: explicitly call await loadFolder(selectedNode.id) in the files
branch of openActivityTarget.

Also: unified resolveActivityTarget return shape to always use
targetId/targetPath regardless of targetType.
This commit is contained in:
mirivlad 2026-06-03 17:23:42 +08:00
parent 0bebcdce8c
commit 4ec03c849f
3 changed files with 10 additions and 6 deletions

View File

@ -16,7 +16,7 @@
background: #13131f; background: #13131f;
} }
</style> </style>
<script type="module" crossorigin src="/assets/main-DctkOBUz.js"></script> <script type="module" crossorigin src="/assets/main-B4NdnBxC.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-BafVhx43.css"> <link rel="stylesheet" crossorigin href="/assets/main-BafVhx43.css">
</head> </head>
<body> <body>

View File

@ -1324,13 +1324,13 @@
function resolveActivityTarget(ev) { function resolveActivityTarget(ev) {
if (ev.targetType === 'note' && ev.targetId) { if (ev.targetType === 'note' && ev.targetId) {
return { nodeId: ev.nodeId, tab: 'notes', noteId: ev.targetId } return { nodeId: ev.nodeId, tab: 'notes', targetId: ev.targetId }
} }
if (ev.targetType === 'file') { if (ev.targetType === 'file') {
return { nodeId: ev.nodeId, tab: 'files', fileId: ev.targetId, targetPath: ev.targetPath } return { nodeId: ev.nodeId, tab: 'files', targetId: ev.targetId, targetPath: ev.targetPath }
} }
if (ev.targetType === 'folder') { if (ev.targetType === 'folder') {
return { nodeId: ev.nodeId, tab: 'files', folderPath: ev.targetPath || ev.targetId } return { nodeId: ev.nodeId, tab: 'files', targetPath: ev.targetPath || ev.targetId }
} }
return { nodeId: ev.nodeId } return { nodeId: ev.nodeId }
} }
@ -1352,6 +1352,10 @@
} }
} else if (target.tab === 'files') { } else if (target.tab === 'files') {
activeTab = 'files' activeTab = 'files'
// Without explicit loadFolder the files tab stays empty because selectNode
// resets fileItems and the tab's click handler doesn't fire on programmatic toggle.
await loadFolder(selectedNode.id)
// target.targetPath is a filesystem path; OpenFolder opens the system file manager.
if (target.targetPath) { if (target.targetPath) {
try { await wailsCall('OpenFolder', target.targetPath) } catch(e) {} try { await wailsCall('OpenFolder', target.targetPath) } catch(e) {}
} }