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
Updated the example with filteredList and sortedList
//!NOTE When items are deleted (from first in list), the fitlered result is wrong. Index are wrong
filteredList: ()=>state$.itemList.filter((item)=>item.value.get()>40000),//IF DELETED ITEMS ORDERED FIRST IN LIST, THEN TOGGLE RANDOMIZE TO SEE SORTED (TAB WILL FREEZE)sortedList: ()=>[...state$.itemList].sort((a,b)=>a.value.get()-b.value.get())
These computed lists will generally work when items are added to the end of the array list or deleted from the array list but will have problems when items are deleted that require index change. For example, when deleting the first item from the list,
Filtered list will not show the correct results (internal indexes out of order). When rendering sortedList deleting items out of order will freeze the tab.
Please refer to the minimal reproducible examples
cpakken/legend-computed-lists-issue
https://stackblitz.com/github/cpakken/legend-computed-lists-issue
Deleting items in a store
Observable<Record<string, Item>>
does not update derived lists() => Object.values(state$.items)
correctly.I suspect there is a probably reactively updating the indexes of derived arrays from Object.values()
Adding and deleting items from the END of list seems to be fine.
Problems when deleting items that require changing indexes will result in issues.
Should work without .peek() or .get() on the computed list
The text was updated successfully, but these errors were encountered: