Skip to content

Commit

Permalink
Merge pull request #1370 from nextcloud-libraries/fix/update-path
Browse files Browse the repository at this point in the history
fix(FilePicker): Forward update of `currentPath` to `navigatedPath`
  • Loading branch information
Pytal authored Jun 24, 2024
2 parents d7560bb + c9a5872 commit 05b78d8
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 05b78d8

Please sign in to comment.