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:
@@ -1324,13 +1324,13 @@
|
||||
|
||||
function resolveActivityTarget(ev) {
|
||||
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') {
|
||||
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') {
|
||||
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 }
|
||||
}
|
||||
@@ -1352,6 +1352,10 @@
|
||||
}
|
||||
} else if (target.tab === '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) {
|
||||
try { await wailsCall('OpenFolder', target.targetPath) } catch(e) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user