Skip to content

Commit 05b78d8

Browse files
authored
Merge pull request #1370 from nextcloud-libraries/fix/update-path
fix(FilePicker): Forward update of `currentPath` to `navigatedPath`
2 parents d7560bb + c9a5872 commit 05b78d8

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/components/FilePicker/FilePicker.vue

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
<div class="file-picker__main">
2323
<!-- Header title / file list breadcrumbs -->
2424
<FilePickerBreadcrumbs v-if="currentView === 'files'"
25-
:path="currentPath"
25+
:path.sync="currentPath"
2626
:show-menu="allowPickDirectory"
27-
@create-node="onCreateFolder"
28-
@update:path="navigatedPath = $event" />
27+
@create-node="onCreateFolder" />
2928
<div v-else class="file-picker__view">
3029
<h3>{{ viewHeadline }}</h3>
3130
</div>
@@ -212,10 +211,16 @@ watch([navigatedPath], () => {
212211
/**
213212
* The current path that should be picked from
214213
*/
215-
const currentPath = computed(() =>
216-
// Only use the path for the files view as favorites and recent only works on the root
217-
currentView.value === 'files' ? navigatedPath.value || props.path || savedPath.value : '/',
218-
)
214+
const currentPath = computed({
215+
get: () => {
216+
// Only use the path for the files view as favorites and recent only works on the root
217+
return currentView.value === 'files' ? navigatedPath.value || props.path || savedPath.value : '/'
218+
},
219+
set: (path: string) => {
220+
// forward setting the current path to the navigated path
221+
navigatedPath.value = path
222+
},
223+
})
219224
220225
/**
221226
* A string used to filter files in current view

0 commit comments

Comments
 (0)