I am trying in implement a multi-data point selection with a onClick Add and Remove for my table
I have noticed , that when trying to add a item to the props.selection.data for the first cycle , the array gets reset but any attempt afterwards, works perfectly fine.
This is issue causes ui to fall out of sync with what is actually inside the props.selection.data array.

Here is the onRowClick event script I am using:
rowIndex=event.row
self.props.data[rowIndex].selected=not self.props.data[rowIndex].selected
# check if row is selected
if self.props.data[rowIndex].selected:
# if row is not inside selection data , add it
if self.props.data[rowIndex].BatchID not in [ x['BatchID'] for x in self.props.selection.data]:
self.props.selection.data.append(self.props.data[rowIndex])
else:
# if row is not selected
data={x['BatchID']:i for i,x in enumerate(self.props.selection.data)}
# if row is in selection data , remove it.
if self.props.data[rowIndex].BatchID in data.keys():
self.props.selection.data.pop(data[self.props.data[rowIndex].BatchID])
Is there a fix for this?
Should I add a onChange check to the props.selection.data to resync the table ui?