Open francoislaurent opened 3 weeks ago
Yeah this is due to our serialization protocol... I tried once to recover original Julia types, but it was a bit hairy, so I decided this should be good enough. If you really need an Int, one should just convert. We could also convert eagerly in user facing some places like slider
This also affects this example: https://simondanisch.github.io/Bonito.jl/stable/widgets.html#WidgetsBase.NumberInput-widgets where there will be a MethodError since the type will not always be Float64.
The
value
attribute of aDOM.input(; type="range")
and theindex
attribute of aSlider
are supposed to be of typeObservable{Int}
, but listeners receive anUInt8
. I would expect they receive anInt
instead.This might be a bug in Observables.jl, but my experience with observables has been fairly stable so far. Type conversion systematically happens, or Julia complains.
My MRE is as follows:
This shows a webpage with two sliders. It also ensures the observables (
index1
andindex2
)'s element type isInt
and registers listeners that test whether the type of the input value is anInt
as expected.Clicking on any of the sliders makes the test fail and generates the exact same error message (appart from one line number):