-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
fix(language-core): camelize props for dynamic component #3774
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
86271d3
tests
so1ve 84f623f
fix: camelize props for `<component>`
so1ve 0ab0dfb
move tests
so1ve b6eda82
refactor: use `node.tagType`
so1ve f777f30
minor refactor
so1ve e3995da
move condition
so1ve a0298fe
Merge branch 'master' into pr/3774
johnsoncodehk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels hacky since the element can be called anything really. It can be a
div
even.Wouldn't it make sense to force camelize when
node.tagType === CompilerDOM.ElementTypes.COMPONENT
? It appears to be a component type in this case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could even dig deeper and try to figure out why
component
is included innativeTags
in the first place. But I wouldn't want to to make it too difficult in here...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW. My initial fix (the d9351d2 commit) for those cases used a variant of the
tagType
check.@johnsoncodehk you've changed it to check against the
nativeTags
without really saying why. Could you explain why you had to do that? Because at least based on the tests, thenativeTags
seems unnecessary and having a hardcoded and potentially outdated list like that feels more hacky than relying on vue compiler itself. While I understand that the Vue compiler might not provide enough information in some cases, at least it's not reflected in the tests (I think) that thenativeTags
check is necessary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nativeTags
is used in the case of using vue-language-tools for projects other than vue, e.g. uni-app projects need to specifynativeTags
to ignore the original tag names: https://github.com/uni-helper/uni-app-types#%E9%85%8D%E7%BD%AEd9351d2 judgment based on
tagType
would break this use case.I plan to remove
nativeTags
from the separate PR and suggest users to modify template compiler options via plugin api to replacenativeTags
option, so it should be possible to change to fullytagType
based judgment.