Skip to content

Unexpected mutation of "list" prop #56

@AndreiSoroka

Description

@AndreiSoroka

Hi

<script setup>
  const list = ref([1,2,3])
</script>
<template>
  <Draggable :list="list"> <!-- <<< here -->
  ...

I expect: the list not will be change
Why? Because :list="list" is a prop

If we want to change, should work two ways:

  1. either
  <Draggable v-model="list">
  <Draggable :model-value="list2" @update:model-value="list2 = $event">
  1. or
  <Draggable :list="list" @change="manualChangeList">

but not

  <Draggable :list="list">

https://vuejs.org/guide/components/props.html#one-way-data-flow
I caught unexpected behavior, which gave rise to a couple of bugs in my code that I had to look for

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions