When the same code with the identical data structure is passed to the prop, it randomly sets the prop as an array or an object.
The following is the code fragment:
const props = defineProps({
all: {
type: Array,
default: [],
}
})
onBeforeMount(() => {
console.log(props.all)
})
The log: Array proxy target prototype for the prop
Object proxy target prototype for the prop
The incoming data passed to the prop is a plain array in both cases.
Therefore, I am unable to confidently use array functions on this prop because sometimes I encounter the error: TypeError: u.all.sort is not a function
What could be the issue or mistake in my approach?