tko icon indicating copy to clipboard operation
tko copied to clipboard

Link array

Open tomm1e opened this issue 5 years ago • 1 comments

Basically I want one main observable array to act as as a "view" for other arrays, in 3.5 I could use: model.array(model.other_array) this way I can switch between arrays.

But it doesn't work this way in 4.0. In 4.0 if you call it that way, it will add the array function as the first item into the array, as seen here: https://jsfiddle.net/eimmot/nrLy0kuh/21/, and if I try to call it as the function, nothing shows: https://jsfiddle.net/eimmot/nrLy0kuh/20

3.5 link directly: https://jsfiddle.net/eimmot/nrLy0kuh/8

4.0 w/ valueHasMutated: https://jsfiddle.net/eimmot/nrLy0kuh/15/

4.0 computed: https://jsfiddle.net/eimmot/nrLy0kuh/18/

So, computed is another method I could use for switching arrays, but can make things complex if you have more than one of these arrays on a page, much easier to be able to just link the array like in 3.5.

tomm1e avatar Mar 07 '20 20:03 tomm1e

Thanks for the great report @tomm1e — I'll try to have a look at it in the not-too-distant future.

brianmhunt avatar Apr 28 '20 13:04 brianmhunt