Skip to content

Parent attributes rewrite prop values of children #7889

Closed as not planned
Closed as not planned
@vzotov

Description

@vzotov

Vue version

3.2.47

Link to minimal reproduction

https://sfc.vuejs.org/#eNqVUU1Lw0AQ/SvDXqLQZLEKQkylRc8ieN1L2kzbaPeD3UlFQv67kw9DW7XoKTszb957mVeLhXPJvkKRiiysfOkIAlLl7pUptbOe4MFqdwVrbzVEieyqdiG6UyaT/QqDuSDUbpcTcgWQdcD2BZAT+XJZEcYm1zhTYvHVgH2+q7Anpy2Cyz0aUqLdk8yTyZFUTERvKNa5S16DNWy5boFqGAQlUug6bY8ttrUSWyIXUikr4942ycpqOeeZ9JWhUmNcWD2/TqbJza0sykCH/QSDjpfevgf0rKjE5IBccnOPPmbDBXr0Z8VOsEeCJ7Nvoq1mo0zDBxiPfz6t6VFa07+mNf0lrWdv3f+CGmV/8AmwsiYQOGYNMIMC16XBViNcDOGNDp7YwBgpAH04Ll94aDZDFAARE+TVjqIUosf+2ZuNBkjTfZvL8xeo62NZaPjmh3/VfAKWThV4

Steps to reproduce

  • Create a component tree where prop name of a grandchild is the same as attribute name for the child

App.vue

<script setup>
import Comp1 from './Comp1.vue';
</script>

<template>
  <Comp1
    attribute-name="Attribute value from the parent"
  />
</template>

Comp1.vue

<script setup>
import Comp2 from './Comp2.vue';
</script>

<template>
  <Comp2
    attribute-name="Prop value from the parent"
  />
</template>

Comp2.vue

<script setup>
  const props = defineProps({
    attributeName: {
      type: String,
      'default': 'Default value',
    },
  });
</script>

<template>
  {{ attributeName }}
</template>

What is expected?

Parent attributes should not rewrite prop values of children

Expected value: "Prop value from the parent"

What is actually happening?

Grandchild gets value from attribute of its grandparent and not from template of its parent

Actual value: "Attribute value from the parent"

System Info

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions