File tree Expand file tree Collapse file tree
lua/nui-components/signal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ function Signal.create(object)
4747 end ,
4848 __newindex = function (t , key , value )
4949 t [self .__index ][key ] = value
50- self ._private .subject (t [self .__index ], key )
50+ self ._private .subject (t [self .__index ])
5151 end ,
5252 })
5353
Original file line number Diff line number Diff line change 1+ local Observable = require (" nui-components.rx.observable" )
12local fn = require (" nui-components.utils.fn" )
23
34local SignalValue = {}
@@ -10,13 +11,13 @@ function SignalValue.create(subject, key)
1011 _private = {
1112 key = key ,
1213 subject = subject ,
13- observable = subject
14- : filter ( function ( _ , k )
15- return k == nil or k == key
16- end )
17- : map ( function ( value )
18- return value [ key ]
19- end ),
14+ observable = Observable . defer ( function ()
15+ return subject
16+ : map ( function ( value )
17+ return value [ key ]
18+ end )
19+ : distinct_until_changed ( vim . deep_equal )
20+ end ),
2021 },
2122 }
2223
@@ -32,7 +33,7 @@ function SignalValue:get_observer_value()
3233end
3334
3435function SignalValue :get_observable ()
35- return self ._private .observable : distinct_until_changed ( vim . deep_equal )
36+ return self ._private .observable
3637end
3738
3839function SignalValue :map (map_fn )
You can’t perform that action at this time.
0 commit comments