mirror of
https://github.com/phfroidmont/scalive.git
synced 2025-12-25 13:36:59 +01:00
Remove the need to wrap every model in ZIO
This commit is contained in:
parent
1da129f855
commit
c19086ef32
6 changed files with 24 additions and 30 deletions
|
|
@ -6,7 +6,7 @@ import zio.stream.ZStream
|
|||
|
||||
class ListLiveView(someParam: String) extends LiveView[Msg, Model]:
|
||||
|
||||
def init = ZIO.succeed(
|
||||
def init =
|
||||
Model(
|
||||
elems = List(
|
||||
NestedModel("a", 10),
|
||||
|
|
@ -14,11 +14,10 @@ class ListLiveView(someParam: String) extends LiveView[Msg, Model]:
|
|||
NestedModel("c", 20)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def update(model: Model) =
|
||||
case Msg.IncAge(value) =>
|
||||
ZIO.succeed(model.focus(_.elems.index(2).age).modify(_ + value))
|
||||
model.focus(_.elems.index(2).age).modify(_ + value)
|
||||
|
||||
def view(model: Dyn[Model]) =
|
||||
div(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue