You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
onClick and onReordered functions end up making a DB write to mark items selected or change their order respectively, and this data then gets passed back into composition through Flows.
The problem is that the canDragOver factory seems to capture what it needs in a closure and be remembered along with its ReorderableLazyListState, not caring that selectedEmployeesMutable was changed. So if I check some checkboxes and then try to reorder selected items, my console will look like this:
Selected employees:
Selected employees: 42
Selected employees: 42, 26
Can drag over 26: false (against [])
Can drag over 26: false (against [])
This issue is even worse for un-checking some items since selectedEmployeesMutable captured in a closure retains wrong items, and this can cause IndexOutOfBoundsExceptions.
So are my assumptions correct and can I fix this on my end, or is the fix needed in the library? Thanks.
The text was updated successfully, but these errors were encountered:
I have a list of selectable items and I want to be able to reorder only selected items. So I have a composable like this:
onClick
andonReordered
functions end up making a DB write to mark items selected or change their order respectively, and this data then gets passed back into composition throughFlow
s.The problem is that the
canDragOver
factory seems to capture what it needs in a closure and be remembered along with itsReorderableLazyListState
, not caring thatselectedEmployeesMutable
was changed. So if I check some checkboxes and then try to reorder selected items, my console will look like this:This issue is even worse for un-checking some items since
selectedEmployeesMutable
captured in a closure retains wrong items, and this can causeIndexOutOfBoundsException
s.So are my assumptions correct and can I fix this on my end, or is the fix needed in the library? Thanks.
The text was updated successfully, but these errors were encountered: