Skip to content

Commit 31cd1b3

Browse files
author
codewec
committed
fix: prevetn update tree
1 parent 34adc76 commit 31cd1b3

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

app/composables/useEditoroContext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export function useEditoroContext() {
4545
pinnedFilePaths: editorRefs.pinnedFilePaths,
4646
showHiddenEntries: refs.preferencesRefs.showHiddenEntries,
4747
setShowHiddenEntries: preferencesStore.setShowHiddenEntries,
48+
selectNodeByPath: treeStore.selectNodeByPath,
4849
treeInitialized: treeRefs.treeInitialized,
4950
editorStore,
5051
loadTree

app/composables/useEditoroFileSelection.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type FileSelectionOptions = {
1818
pinnedFilePaths: Ref<string[]>
1919
showHiddenEntries: Ref<boolean>
2020
setShowHiddenEntries: (nextValue: boolean) => void
21+
selectNodeByPath: (path: string) => void
2122
treeInitialized: Ref<boolean>
2223
editorStore: EditorStoreLike
2324
loadTree: (preferPath?: string) => Promise<void>
@@ -53,8 +54,19 @@ export function useEditoroFileSelection(options: FileSelectionOptions) {
5354
return false
5455
}
5556

57+
if (options.selectedNode.value?.path === path) {
58+
return true
59+
}
60+
5661
if (hasHiddenPathSegment(path) && !options.showHiddenEntries.value) {
5762
options.setShowHiddenEntries(true)
63+
await options.loadTree(path)
64+
return options.selectedNode.value?.path === path
65+
}
66+
67+
options.selectNodeByPath(path)
68+
if (options.selectedNode.value?.path === path) {
69+
return true
5870
}
5971

6072
await options.loadTree(path)

0 commit comments

Comments
 (0)