emberjs / emberjs/ember.js

[Bug] LinkTo do not generates href when @model is defined as undefined

Open
#19,978 6 comments 0 reactions 0 assignees View on GitHub
Needs Submitter Response Routing
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

### 🐞 Describe the Bug
When using LinkTo in a component and we want `@model` to be optional, the href is not being generated if no model is provided.

### 🔬 Minimal Reproduction
https://gist.github.com/rogeraraujo90/bc68849c7bf81bba7e0127706c690111

### 😕 Actual Behavior
The href is generated as `#`

### 🤔 Expected Behavior
The href should be generated correctly to the provided route.

PS: If I remove the `@model` from the LinkTo component the href is generated correctly in my Ember version. Is not working well on Twiddle.

### 🌍 Environment

- Ember: 3.28.8
- Node.js/npm: 14.16.1
- OS: Windows
- Browser: Brave (chromium based)

### ➕ Additional Context
Even though I couldn't fix the problem in the twiddle, in my project I could by removing the `@model` param in my component. But this is not ideal because since this is a component, I would like to have the possibility to pass a model or not.

Discord discussion: https://discord.com/channels/480462759797063690/483601670685720591/943929878108069978

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.