Skip to content

Commit

Permalink
fix(FilePicker): Forward update of currentPath to navigatedPath
Browse files Browse the repository at this point in the history
Allow to use `:path.sync="currentPath"` and fixes regression where changing the folder
by clicking a folder in the file list does not navigate to that folder.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Jun 24, 2024
1 parent 78dabcc commit c9a5872
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/components/FilePicker/FilePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
<div class="file-picker__main">
<!-- Header title / file list breadcrumbs -->
<FilePickerBreadcrumbs v-if="currentView === 'files'"
:path="currentPath"
:path.sync="currentPath"
:show-menu="allowPickDirectory"
@create-node="onCreateFolder"
@update:path="navigatedPath = $event" />
@create-node="onCreateFolder" />
<div v-else class="file-picker__view">
<h3>{{ viewHeadline }}</h3>
</div>
Expand Down Expand Up @@ -212,10 +211,16 @@ watch([navigatedPath], () => {
/**
* The current path that should be picked from
*/
const currentPath = computed(() =>
// Only use the path for the files view as favorites and recent only works on the root
currentView.value === 'files' ? navigatedPath.value || props.path || savedPath.value : '/',
)
const currentPath = computed({
get: () => {
// Only use the path for the files view as favorites and recent only works on the root
return currentView.value === 'files' ? navigatedPath.value || props.path || savedPath.value : '/'
},
set: (path: string) => {
// forward setting the current path to the navigated path
navigatedPath.value = path
},
})
/**
* A string used to filter files in current view
Expand Down

0 comments on commit c9a5872

Please sign in to comment.