vuejs / core

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
https://vuejs.org/
MIT License
45.64k stars 8k forks source link

Custom Web Elements/Components receive `undefined` instead of `false` on subsequent re-render #11276

Open Maxim-Mazurok opened 3 days ago

Maxim-Mazurok commented 3 days ago

Vue version

3.4.31

Link to minimal reproduction

https://jsfiddle.net/uwegz5y8/23/

Steps to reproduce

  1. Load repro
  2. See Boo: false; typeof: boolean - as expected, because boo attribute is not set
  3. Click "Toggle Boo"
  4. See Boo: true; typeof: boolean - as expected, because now boo attribute is set
  5. Click "Toggle Boo" again
  6. See Boo: ; typeof: undefined - unexpected, since boo attribute is removed - we expect to receive false just like in the 2nd step previously

What is expected?

false

What is actually happening?

undefined

System Info

No response

Any additional comments?

This is similar to https://github.com/vuejs/core/issues/10324, which was not actually a duplicate of #9006

https://github.com/vuejs/core/commit/b49306adff4572d90a42ccd231387f16eb966bbe didn't fix the issue. All it did was to change null to undefined in the 6th step of the original issue reproduction.

Kinda related to #9697

linzhe141 commented 3 days ago

playground