emberjs / emberjs/ember.js

[Bug] Conditional if not working

Open
#20,255 11 comments 0 reactions 0 assignees View on GitHub
Has Reproduction modifiers
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

### 🐞 Describe the Bug
Conditional if modifier is incorrectly destroyed

### 🔬 Minimal Reproduction
Demo repo:
https://github.com/amk221/-ember-modifier-inline-if/commit/300d8202c4161c5d5c9391b4e99e7ee681325a20

GIF:
![gif](https://user-images.githubusercontent.com/382061/200014638-fdda4b78-a4c6-443d-ba98-e8bf07470614.gif)

### 😕 Actual Behavior
As the above gif shows, when a boolean in the template is true "This should be red" is rendered and that works of course.
But, that same boolean controls the presence of a modifier. And that modifier gets incorrectly destroyed.

### 🤔 Expected Behavior
We are left with a boolean that is true (and so the modifier should be present). But it is not.

### 🌍 Environment

- Ember: ~4.8.0
- Node.js/npm: v14.19.1 / 8.13.2
- OS: Ventura
- Browser: Any

### ➕ Additional Context
In the demo repo, I have included a second example that works, to prove that the first example is broken

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.