@noView on view-model navigated to by router throws TypeError in aurelia-templating
- Dominant language
- TypeScript
- Stars
- 113
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
It is possible to create a custom element without a view by applying the `@noView` annotation on top of that custom element's view model. However, if you do the same thing to a view that is the target of a route, [this line](https://github.com/aurelia/templating/blob/master/src/controller.js#L72) in `Controller.automate()` in `aurelia-templating` blows up because it assumes a `view` property to be defined that is not.
Here is a gist.run that shows the issue. If you remove the `@noView` annotation from `route.js`, the route renders correctly.
https://gist.run/?id=14a083656624a84e51731baae5511e55
After lots of reading, the closest documentation I have found on the subject is via @EisenbergEffect on Issue #238:
> [C]urrently, the router enforces that all view models that get rendered must have a View. We may be able to change that in the future though.
It sounds like this just happens to be how it works, rather than desired behavior. Should I expect this hard requirement to change? If not, what should I be doing when I do not have anything for the router to render?
Contributor guide
Research direction
Reproduce the route case from the linked gist, then inspect src/controller.js at line 72 in Controller.automate() and compare it with the @noView custom-element behavior described in the issue. Determine the intended router behavior for a view-model without a view; done means the route no longer throws a TypeError and that behavior is documented or covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100