aurelia / aurelia/templating-resources

oneTime binding inside if inside repeat does not work as expected

Open
#356 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
55
Forks
55
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a bug report**

* **Library Version:**
1.7.1

**Please tell us about your environment:**
* **Operating System:**
OSX 10.x

* **Node Version:**
8.9.1

* **NPM Version:**
61.0

* **JSPM OR Webpack AND Version**
webpack@4.8.3

* **Browser:**
all

* **Language:**
all

**Current behavior:**
Similar to aurelia/framework#301: `repeat.for` and `oneTime` bindings don’t work properly together.

The specific problem in aurelia/framework#301 is fixed, but as soon as you insert a `if.bind` between the `repeat.for` and the One-Time-Binding, the problem reappears:

welcome.html
```Html

Click me!



${item.prop1 & oneTime}

```

welcome.js
```
export class Welcome {
items = [{prop1:1},{prop1:2},{prop1:3}];

clickme() {
this.items = [{prop1:4},{prop1:5}];
}
}
```

After clicking the button, the content reads
```
1
2
```
i.e. the number of items is updated, but their content is not.

**Expected/desired behavior:**
After clicking the button, the content should be
```
4
5
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue from the welcome.html template and welcome.js example using Aurelia 1.7.1 with webpack@4.8.3. Start by checking how repeat.for, if.bind, and the oneTime binding interact, then confirm that clicking the button changes the rendered values from 1 and 2 to 4 and 5.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.