[BUGFIX] Add assertion for invalid component helper argument#21406
Open
olenderhub wants to merge 2 commits into
Open
[BUGFIX] Add assertion for invalid component helper argument#21406olenderhub wants to merge 2 commits into
olenderhub wants to merge 2 commits into
Conversation
| typeof component === 'string' || | ||
| isCurriedValue(component) || | ||
| ((typeof component === 'object' || typeof component === 'function') && | ||
| hasInternalComponentManager(component)), |
Contributor
There was a problem hiding this comment.
I had to double check this because hasInternalComponentManager is misleadingly named -- this is what we want and would work with 3rd-party component managers
| isCurriedValue(component) || | ||
| ((typeof component === 'object' || typeof component === 'function') && | ||
| hasInternalComponentManager(component)), | ||
| 'The `{{component}}` helper received an invalid value. It expects a component definition, or a string component name in non-strict mode.' |
Contributor
There was a problem hiding this comment.
looks like on line 168 above we know if we are in strict mode or not, so we can change this message to be a bit more precise based on isStrict
Contributor
|
I think this is pretty close! just one last thing |
Contributor
Author
|
I added improvements @NullVoxPopuli please check it |
Contributor
Author
|
@NullVoxPopuli sorry I see still some errors, checking it |
7d7a8b2 to
94d6e6c
Compare
Contributor
Author
|
@NullVoxPopuli I believe now is ready to review again. Please check it |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #18072
Adds a debug assertion in the dynamic component resolution opcode to throw a useful error when the
{{component}}helper receives an invalid argument type, e.g. an object, instead of failing with a cryptic error.Adds a test to verify the assertion fires with the expected message.
Tested with:
pnpm test:wip