Appcelerator Alloy data binding - transfrom is called twice?

36 views Asked by At

I have a collection with model transform function. I transform my model to the desired structure and return it. To debug something I have printed out to console the item id. This collection is binded to a ListView and in my controller I call the collection fetch method. What I suddenly notice since I'm outputting the item id to the console is that I see it running twice. This is my output:

[INFO] item.id = 51120f4b-a60b-4c46-a776-453e60faede3
[INFO] item.id = 874ba847-95eb-bb65-b1a5-4e8d8950bcf2
[INFO] item.id = 77590380-6045-6105-0604-e905807060ba
[INFO] item.id = 51120f4b-a60b-4c46-a776-453e60faede3
[INFO] item.id = 874ba847-95eb-bb65-b1a5-4e8d8950bcf2
[INFO] item.id = 77590380-6045-6105-0604-e905807060ba

You can see that each item is processed twice and they are processed in the same order. So I'm guessing I have some performance hit here due to the fact that it's running twice. Any explanation?

Looking more into it - the read operation from the db occurs only once. It's the transform method that is called twice.

0

There are 0 answers