Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the display text on computed values that are not accessed. #535

Open
NHZEX opened this issue Jul 21, 2024 · 4 comments
Open

Improve the display text on computed values that are not accessed. #535

NHZEX opened this issue Jul 21, 2024 · 4 comments
Assignees
Labels
applet Applet package

Comments

@NHZEX
Copy link

NHZEX commented Jul 21, 2024

I encountered an issue where a computed property shows as undefined in the Vue Devtools when it's not used in the template. This behavior is confusing and can make debugging more difficult.

Preview: https://stackblitz.com/edit/vitejs-vite-md6fq8?file=src%2Fcomponents%2FHelloWorld.vue

@alexzhang1030 alexzhang1030 self-assigned this Jul 22, 2024
@alexzhang1030
Copy link
Member

alexzhang1030 commented Jul 22, 2024

This is a vue design pattern. Computers are lazy, we will never know its value until somewhere access computedValue.value. See computed implementation

@alexzhang1030 alexzhang1030 added the wontfix This will not be worked on label Jul 22, 2024
@alexzhang1030 alexzhang1030 reopened this Jul 22, 2024
@alexzhang1030 alexzhang1030 removed the wontfix This will not be worked on label Jul 22, 2024
@alexzhang1030
Copy link
Member

We can improve the display text on computed values that are not accessed.

@alexzhang1030 alexzhang1030 changed the title Why does computed value show as undefined in the template when not used Improve the display text on computed values that are not accessed. Jul 22, 2024
@alexzhang1030 alexzhang1030 added applet Applet package and removed vue design labels Jul 22, 2024
@NHZEX
Copy link
Author

NHZEX commented Jul 22, 2024

We can improve the display text on computed values that are not accessed.

Is it possible to provide a feature in devtools that actively triggers the computation of these values?

@alexzhang1030
Copy link
Member

alexzhang1030 commented Jul 23, 2024

We can improve the display text on computed values that are not accessed.

Is it possible to provide a feature in devtools that actively triggers the computation of these values?

I would not recommend doing it. Access value will make devtools the computed values' dependency, which will mess up the reactivity system and introduce some perf issues.

In the future, we might make this as a devtools plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
applet Applet package
Projects
None yet
Development

No branches or pull requests

2 participants