Unable to sort a `Collection` with `@cycle/state`
I'm trying to render a list of state.items with makeCollection and I'm using a state lens where the getter sorts that list based on a state.sort value and returns it.
Clicking a "sort" button would update the state.sort value and the lens getter is invoked, creates a new list, sorts and then returns it, but the dom items are not reordered until the next update to state.items.
After further investigating the issue, I found that pickCombine might be the culprit and changing these lines to
if (!ils.has(key)) {
ils.set(key, new PickCombineListener(key, out, this, sink))
}
sink._remove(ils.get(key))
sink._add(ils.get(key))would make it work, though I'm not sure about the implications and I don't know if it's introducing a memory leak.
Expected behavior:
Clicking the Toggle sort button would sort the list items in asc/desc/none order.
Actual behavior: The DOM doesn't update until you add a new item.
Versions of packages used:
"@cycle/dom": "22.6.0",
"@cycle/isolate": "5.2.0",
"@cycle/run": "5.4.0",
"@cycle/state": "1.4.0",
"snabbdom": "0.7.4",
"xstream": "11.11.0"Source: cyclejs/cyclejs