[BUGFIX] Add assertion for invalid component helper argument#21406
[BUGFIX] Add assertion for invalid component helper argument#21406olenderhub wants to merge 2 commits into
Conversation
| typeof component === 'string' || | ||
| isCurriedValue(component) || | ||
| ((typeof component === 'object' || typeof component === 'function') && | ||
| hasInternalComponentManager(component)), |
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.' |
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
|
I think this is pretty close! just one last thing |
|
I added improvements @NullVoxPopuli please check it |
|
@NullVoxPopuli sorry I see still some errors, checking it |
7d7a8b2 to
94d6e6c
Compare
|
@NullVoxPopuli I believe now is ready to review again. Please check it |
NullVoxPopuli
left a comment
There was a problem hiding this comment.
the strict mode test is a little goofy, but otherwise looks good. would be happy to merge once the strict mode test is updated
| } | ||
|
|
||
| assert.throws(() => { | ||
| this.owner.register( |
There was a problem hiding this comment.
why is there a registration here? (our strict mode tests generally don't have registration, and def don't use attrs)
we do have strict mode examples if you want to poke around to see how those tests are done, I forget the exact API now, but there are quite a few (especially around the new helpers)
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