Skip to content

Commit

Permalink
fix: Use shallowRef instead of shallowReactive because Vue 2 limi…
Browse files Browse the repository at this point in the history
…tation

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Jun 21, 2024
1 parent 1a2fc17 commit c687a9b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/components/FilePicker/FilePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import FilePickerNavigation from './FilePickerNavigation.vue'
import { emit as emitOnEventBus } from '@nextcloud/event-bus'
import { NcDialog, NcEmptyContent } from '@nextcloud/vue'
import { computed, onMounted, ref, shallowReactive, toRef, watch } from 'vue'
import { computed, onMounted, ref, shallowRef, toRef, watch } from 'vue'
import { showError } from '../../toast'
import { useDAVFiles } from '../../composables/dav'
import { useMimeFilter } from '../../composables/mime'
Expand Down Expand Up @@ -147,7 +147,7 @@ const isOpen = ref(true)
* Map buttons to Dialog buttons by wrapping the callback function to pass the selected files
*/
const dialogButtons = computed(() => {
const nodes = selectedFiles.length === 0 && props.allowPickDirectory && currentFolder.value ? [currentFolder.value] : selectedFiles
const nodes = selectedFiles.value.length === 0 && props.allowPickDirectory && currentFolder.value ? [currentFolder.value] : selectedFiles.value
const buttons = typeof props.buttons === 'function'
? props.buttons(nodes, currentPath.value, currentView.value)
: props.buttons
Expand Down Expand Up @@ -188,7 +188,7 @@ const viewHeadline = computed(() => currentView.value === 'favorites' ? t('Favor
/**
* All currently selected files
*/
const selectedFiles = shallowReactive<Node[]>([])
const selectedFiles = shallowRef<Node[]>([])
/**
* Last path navigated to using the file picker
Expand All @@ -205,7 +205,7 @@ watch([navigatedPath], () => {
if (props.path === undefined && navigatedPath.value) {
window.sessionStorage.setItem('NC.FilePicker.LastPath', navigatedPath.value)
// Reset selected files
selectedFiles.splice(0, selectedFiles.length)
selectedFiles.value = []
}
})
Expand Down

0 comments on commit c687a9b

Please sign in to comment.