Skip to content

Commit c687a9b

Browse files
committed
fix: Use shallowRef instead of shallowReactive because Vue 2 limitation
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 1a2fc17 commit c687a9b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/components/FilePicker/FilePicker.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ import FilePickerNavigation from './FilePickerNavigation.vue'
7272

7373
import { emit as emitOnEventBus } from '@nextcloud/event-bus'
7474
import { NcDialog, NcEmptyContent } from '@nextcloud/vue'
75-
import { computed, onMounted, ref, shallowReactive, toRef, watch } from 'vue'
75+
import { computed, onMounted, ref, shallowRef, toRef, watch } from 'vue'
7676
import { showError } from '../../toast'
7777
import { useDAVFiles } from '../../composables/dav'
7878
import { useMimeFilter } from '../../composables/mime'
@@ -147,7 +147,7 @@ const isOpen = ref(true)
147147
* Map buttons to Dialog buttons by wrapping the callback function to pass the selected files
148148
*/
149149
const dialogButtons = computed(() => {
150-
const nodes = selectedFiles.length === 0 && props.allowPickDirectory && currentFolder.value ? [currentFolder.value] : selectedFiles
150+
const nodes = selectedFiles.value.length === 0 && props.allowPickDirectory && currentFolder.value ? [currentFolder.value] : selectedFiles.value
151151
const buttons = typeof props.buttons === 'function'
152152
? props.buttons(nodes, currentPath.value, currentView.value)
153153
: props.buttons
@@ -188,7 +188,7 @@ const viewHeadline = computed(() => currentView.value === 'favorites' ? t('Favor
188188
/**
189189
* All currently selected files
190190
*/
191-
const selectedFiles = shallowReactive<Node[]>([])
191+
const selectedFiles = shallowRef<Node[]>([])
192192

193193
/**
194194
* Last path navigated to using the file picker
@@ -205,7 +205,7 @@ watch([navigatedPath], () => {
205205
if (props.path === undefined && navigatedPath.value) {
206206
window.sessionStorage.setItem('NC.FilePicker.LastPath', navigatedPath.value)
207207
// Reset selected files
208-
selectedFiles.splice(0, selectedFiles.length)
208+
selectedFiles.value = []
209209
}
210210
})
211211

0 commit comments

Comments
 (0)