Confused with behavior of grid multiselection

Code is

			let selections = grid.selection.getCells();
			selections.forEach((item, index, array) => {
				grid.data.remove(item.row.id);
			});

want to remove all the selected rows of a grid but only first one deleted. Have to rewrite as

			let selections = grid.selection.getCells();
			let rows = [];
			selections.forEach((item, index, array) => {
				rows.push(item.row.id);
			});
			grid.data.remove(rows);

I think selections has been changed after the first selection is removed. Is this a bug?

Please, try to slice your array saving the selected rows:

			let selections = grid.selection.getCells().slice();
			selections.forEach((item, index, array) => {
				grid.data.remove(item.row.id);
			});

as the selection changes after the removing one of the the selected rows.