Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI: next
- Cross-platform modules: next
- Android Runtime: next
- iOS Runtime: next
Describe the bug
When you call ObservableArray.splice(), the event it emits fails to account for replaced items. This means it accounts only for removals/inserts, but any replace returns an added count of 0
To Reproduce
https://play.nativescript.org/?template=play-ng&id=jVKVft
Expected behavior
addedCount should take into account the replaced items
Additional context
Maybe we should change addedCount to this._array.length + removed.length - oldLength
I ran into this issue trying to splice FormattedString.spans. The only way I could make it work was by either:
- removing and adding again
- applying the addedCount fix I proposed
Since ObservableArray is used almost everywhere, this change could be breaking.
Reactions are currently unavailable
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
Describe the bug
When you call ObservableArray.splice(), the event it emits fails to account for replaced items. This means it accounts only for removals/inserts, but any replace returns an added count of 0
To Reproduce
https://play.nativescript.org/?template=play-ng&id=jVKVft
Expected behavior
addedCount should take into account the replaced items
Additional context
Maybe we should change addedCount to this._array.length + removed.length - oldLength
I ran into this issue trying to splice FormattedString.spans. The only way I could make it work was by either:
Since ObservableArray is used almost everywhere, this change could be breaking.