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

Disallowed component prop keys should render explicit error #10281

Closed
wmelton opened this issue Feb 6, 2024 · 0 comments
Closed

Disallowed component prop keys should render explicit error #10281

wmelton opened this issue Feb 6, 2024 · 0 comments
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed.

Comments

@wmelton
Copy link

wmelton commented Feb 6, 2024

Vue version

latest

Link to minimal reproduction

https://gist.github.com/wmelton/534f7466e536d215d4c50e5d7a861a93

Steps to reproduce

See minimal reproduction link. If you define a component with a prop key of key then a warning will be thrown that doesn't describe what the issue actually is.

What is expected?

Given that specific prop keys are not allowed by vue implicitly, it should be converted to an explicit error with a specific message that indicates that specific component prop keys are disallowed or will not render correctly by Vue.

The current DX is non-transparent about what the root issue actually is. An error message like:

[Error]: "key" is not an allowed component prop would go a long way in debugging an error like this.

What is actually happening?

if you define a component prop key you will get the following warning even after passing a value for the key prop:

[Vue warn]: Invalid prop: type check failed for prop "key". Expected String with value "undefined", got Undefined

By changing our prop to something like, "componentKey", then it works as expected.

System Info

No response

Any additional comments?

No response

@yyx990803 yyx990803 added the 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. label Feb 7, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 24, 2024
wangdaoo pushed a commit to wangdaoo/core that referenced this issue May 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants