mirror of
https://github.com/phfroidmont/scalive.git
synced 2025-12-25 05:26:59 +01:00
Fix ordering on splitByKey
This commit is contained in:
parent
cbd5229025
commit
d011477d9e
1 changed files with 3 additions and 3 deletions
|
|
@ -37,7 +37,7 @@ sealed trait Dyn[T]:
|
||||||
private[scalive] def callOnEveryChild(f: T => Unit): Unit
|
private[scalive] def callOnEveryChild(f: T => Unit): Unit
|
||||||
|
|
||||||
extension [T](parent: Dyn[List[T]])
|
extension [T](parent: Dyn[List[T]])
|
||||||
def splitBy[Key](key: T => Key)(project: (Key, Dyn[T]) => HtmlElement): Mod =
|
def splitBy[Key: Ordering](key: T => Key)(project: (Key, Dyn[T]) => HtmlElement): Mod =
|
||||||
Mod.Content.DynSplit(
|
Mod.Content.DynSplit(
|
||||||
new SplitVar(
|
new SplitVar(
|
||||||
parent,
|
parent,
|
||||||
|
|
@ -90,13 +90,13 @@ private class DerivedVar[I, O] private[scalive] (parent: Var[I], f: I => O) exte
|
||||||
|
|
||||||
private[scalive] def callOnEveryChild(f: O => Unit): Unit = f(currentValue)
|
private[scalive] def callOnEveryChild(f: O => Unit): Unit = f(currentValue)
|
||||||
|
|
||||||
private class SplitVar[I, O, Key](
|
private class SplitVar[I, O, Key: Ordering](
|
||||||
parent: Dyn[List[I]],
|
parent: Dyn[List[I]],
|
||||||
key: I => Key,
|
key: I => Key,
|
||||||
project: (Key, Dyn[I]) => O):
|
project: (Key, Dyn[I]) => O):
|
||||||
|
|
||||||
private val memoized: mutable.Map[Key, (Var[I], O)] =
|
private val memoized: mutable.Map[Key, (Var[I], O)] =
|
||||||
mutable.Map.empty
|
mutable.TreeMap.empty
|
||||||
|
|
||||||
private var previousKeysToIndex: Map[Key, Int] = Map.empty
|
private var previousKeysToIndex: Map[Key, Int] = Map.empty
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue