Subscribe on changes!

Script Setup Does Not Populate Name Property

avatar
Feb 15th 2024

Vue version

3.4.19

Link to minimal reproduction

https://play.vuejs.org/#eNp9UtuK2zAQ/ZWpKNgBYz/sW5oE2mUfUuiFto+CRWtPHG3lkdElTRv87x3JTXbpXl7M+Jy5nDmjk3g/jvUholiKVcBhNCrgRhLA6toOIzQcr5pHBP/61ukxgMcQRzCK+rUUwUvBrB5G6wLk0p2zA0hRN+kvjZDiXWo2l29ExUWtpZ3u63tviQWc0lwpWs7XBt2XMWhL3HgJmUmcMsb++pix4CJWZ7zdY/vzGfzeHxMmxVeHHt2BRVy4oFyPYaZvvn/GI8cXcrBdNJz9CvkNvTUxaZzTPkTqWPajvKx2mz3R1P/wN8eA5M9LJaEpc8r5UrBFyaqXVn+Qe1Vf5TpJE7t4tvfpBTt9yAHMBynzxRZvMtfM5Gu3fbjnCSx9spECdhWwiOvoHFLYkg+KWoRpPnbBKgq+saSmgS04VEb/QY5aRdBZCHvtK7iLAbZFB06FPToGEUgNCHcImnbInTtQ1CUNqVGHO034z5CS3eDeuWAJRVqrSMi0yGP5OfnAXfizfkZnuahHZ4+/U+plobJcwHoz25zqrcHa2L4ssgdFldvVb+0soE6T/8dubxOaJGQdlycuSUx/AR6AI9U=

Steps to reproduce

Go to the link, open the debugger, and notice that the instance does not have the name property set.

What is expected?

The instance's name property is set.

What is actually happening?

I know that __name gets set, but that's not listed in the docs as something we can use, so it seems like it's an internal, private value that we should not be using.

System Info

Firefox

Any additional comments?

I also know that I can use defineOptions to set the name, but I don't want to have to remember to do this across all my files. This seems like it might be the opposite of https://github.com/vuejs/core/issues/6357

avatar
Feb 19th 2024

This is expected behavior. The inferred name is added as an internal option because otherwise it would result in backwards-incompatible behavior (see https://github.com/vuejs/core/commit/9734b31c312244a2b5c5cf83c75d7b34076a0c4b)

avatar
Feb 19th 2024

@yyx990803 if that's the case, is it possible __name could be added to the docs? Otherwise, it feels unsafe to use because it's undocumented.