Closed Chhay67 closed 1 month ago
@Chhay67 The goal here is to ensure that any addition or removal of events is done using the controller to properly reflect changes in the UI.
Previously, to achieve this, we used the toList method in the events getter to create and return a copy of the events list. This way, any changes to the returned list would not affect the data in the controller or the UI. However, this approach can cause performance issues if the events list is large and used frequently, as it iterates through all the events to return a new list. For those who do not intend to manipulate the list but merely want to retrieve or filter specific events, this degrades performance.
So, we suggest, If you need to manipulate the list, you can always use the toList method to create a new list and then make the necessary changes.
for the old version, I can delete, because when controller.events it return List so I can delete all of the events data.