tables icon indicating copy to clipboard operation
tables copied to clipboard

Replace 'forEach' with 'map' if mutating original data is not the goal

Open silverkszlo opened this issue 5 months ago • 0 comments

forEach would change the column.selectionOptions objects directly (since filter doesn’t create copies). Was that the intention? If the goal is only to adjust the labels for display, maybe map could be a safer choice to avoid mutating the original data?

Originally posted by @silverkszlo in https://github.com/nextcloud/tables/pull/1975#discussion_r2282837014

Yeah, that's a good point. I copied this function from the existing code at https://github.com/nextcloud/tables/blob/038a943b443e8ba6e99074b8ed721d4f03ee2b09/src/shared/components/ncTable/partials/rowTypePartials/SelectionMultiForm.vue#L48. Unrelated to inline editing so should be updated separately everywhere.

Originally posted by @enjeck in https://github.com/nextcloud/tables/pull/1975#discussion_r2282847774

silverkszlo avatar Aug 19 '25 08:08 silverkszlo