Reactive not behaving like an Observable
See original GitHub issueI’m trying to connect a model parameter (which is therefore of type Reactive
) through a function with a bunch of observables, like this:
map!(any, model.disable, bad_firstname, bad_lastname, bad_email, bad_password)
and I’m getting these errors:
ERROR: LoadError: MethodError: no method matching Observables.MapUpdater(::typeof(any), ::Reactive{Bool})
Closest candidates are:
Observables.MapUpdater(::F, ::Observable{T}) where {F, T} at /home/yakir/.julia/packages/Observables/OFj0u/src/Observables.jl:367
Stacktrace:
[1] map!(::typeof(any), ::Reactive{Bool}, ::Observable{Bool}, ::Vararg{Observable{Bool}, N} where N; update::Bool)
@ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:416
[2] map!(::typeof(any), ::Reactive{Bool}, ::Observable{Bool}, ::Observable{Bool}, ::Observable{Bool}, ::Vararg{Observable{Bool}, N} where N)
@ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:416
[3] top-level scope
@ ~/tmp tests 4 stipple/UserUI.jl:55
[4] include(fname::String)
@ Base.MainInclude ./client.jl:444
[5] top-level scope
@ REPL[3]:1
in expression starting at /home/yakir/tmp tests 4 stipple/UserUI.jl:55
Is this a known issue due to how Reactive
is implemented, or am I doing something wrong here?
MWE
Temp env with just Stipple and Observables
julia> using Stipple, Observables
julia> r = Reactive(true)
WARNING: both HttpCommon and Genie export "Headers"; uses of it in module Html must be qualified
WARNING: both Html and Base export "div"; uses of it in module Stipple must be qualified
WARNING: both Html and Base export "mark"; uses of it in module Stipple must be qualified
WARNING: both Html and Base export "summary"; uses of it in module Stipple must be qualified
WARNING: both Html and Base export "time"; uses of it in module Stipple must be qualified
Reactive{Bool}(Observable{Bool} with 0 listeners. Value:
true, 0, false, false)
julia> o1, o2, o3 = (Observable(false), Observable(true), Observable(false))
(Observable{Bool} with 0 listeners. Value:
false, Observable{Bool} with 0 listeners. Value:
true, Observable{Bool} with 0 listeners. Value:
false)
julia> map!(any, r, o1, o2, o3)
ERROR: MethodError: no method matching Observables.MapUpdater(::typeof(any), ::Reactive{Bool})
Closest candidates are:
Observables.MapUpdater(::F, ::Observable{T}) where {F, T} at /home/yakir/.julia/packages/Observables/OFj0u/src/Observables.jl:367
Stacktrace:
[1] #map!#11
@ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:416 [inlined]
[2] map!(::typeof(any), ::Reactive{Bool}, ::Observable{Bool}, ::Observable{Bool}, ::Observable{Bool})
@ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:416
[3] top-level scope
@ REPL[6]:1
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Observables, Reactive Programming, and Regret
Reactive programming isn't necessarily observables. Reactive programming is a paradigm or a practice. It can be done with functions, Promises, ...
Read more >ReactiveCommand not handling observable call as expected
I'm using ReactiveCommand.CreateAsyncObservable to invoke this, using SubscribeOn(RxApp.TaskpoolScheduler) (to ensure the Thread.Sleep doesn't ...
Read more >Observable - ReactiveX
An Observable calls this method whenever the Observable emits an item. This method takes as a parameter the item emitted by the Observable....
Read more >Deep Dive into Reactive Programming with RxJS - InfoQ
Observables are lazy. This allows writing efficient code that's more declarative. It's useful to think of observables as collections and apply ...
Read more >3 Common Rxjs Pitfalls (and how to avoid them)
We can think of it as something close to a function. Creating an observable is somewhat similar to declaring a function, the function...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I leave this open until we know, how the maintainers of Observables will deal with the PR.
@timholy explained in the issue above why our PR was not a good solution. So we stick with our workaround, which seems to be the correct implementation. (I had actually forgotten that i fixed this and just reinvented the workaround a second time …)