Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FilePicker): Forward update of currentPath to navigatedPath #1370

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading