feat: ArrayObserver... intercept array.length assignment and notify subscribers
- Dominant language
- JavaScript
- Stars
- 110
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
@ZoolWay commented on [Wed Jul 27 2016](https://github.com/aurelia/framework/issues/491)
**I'm submitting a bug report**
- **Library Version:**
aurelia-framework 1.0.0-rc.1.0.13
**Please tell us about your environment:**
- **Operating System:**
Windows 10
- **Node Version:**
6.3.1
- **NPM Version:**
3.10.3
- **JSPM OR Webpack AND Version**
JSPM 0.16.39
- **Browser:**
Chrome 51.0.2704.103 m
- **Language:**
all
**Current behavior:**
When I reset an array by setting its `length` to `0` its items in a `repeat.for` are no longer removed.
This example shows three possibilities to clear:
https://gist.run/?id=4caf35a8abc1cedfc8487df1ea997548
Splice and replace still work, setting length not. When you try to clear with setting length to 0 a splice after that call will also **not** work (while replacing still would)!
_Note_: I have experimented using the TaskQueue because at first I though it was a problem with that.
**Expected/desired behavior:**
This was working in aurelia-framework 1.0.0-rc.1.0.0. When setting the length to zero and adding new items, the list was cleared and rebuild as expected.
Contributor guide
Research direction
Start with the ArrayObserver entry point named in the issue and reproduce the reported difference between setting array.length, splice, and replacement. Verify that clearing with length = 0 removes repeat.for items and that a later splice still notifies subscribers and updates the list.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100