Makie.jl updating Observable causes "cannot convert a value to nothing for assignment"

Since Makie does not have a mechanism for detecting axis limit updates I decided to make my own wrapper with Observables.

I am having a strange error when triggering the notify in set_xlims!. I think this is a deeper bug but unsure, hopefully the stacktrace can point us in the right direction.

mutable struct Chart
    fig::Figure
    ax::Axis
    limits::Observable{Any}
end

function set_xlims!(C::Chart, xmin, xmax)
    xlims!(C.ax, xmin, xmax)
    # C.limits[] = ((xmin, xmax), C.limits[][2])
    C.limits.val = 1
    notify(C.limits)
end

# Only errors if listening to changes
lift(base_chart.limits) do l
 ...
end


Error in callback:
cannot convert a value to nothing for assignment
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] nonnothingtype_checked(T::Type)
    @ Base ./some.jl:32
  [3] convert(::Type{Nothing}, x::Vector{Float64})
    @ Base ./some.jl:37
  [4] setproperty!(x::Observables.Observable{Nothing}, f::Symbol, v::Vector{Float64})
    @ Base ./Base.jl:40
  [5] setindex!(observable::Observables.Observable, val::Any)
    @ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:122
  [6] (::Observables.MapCallback)(value::Any)
    @ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:436
  [7] #invokelatest#2
    @ ./essentials.jl:887 [inlined]
  [8] invokelatest
    @ ./essentials.jl:884 [inlined]
  [9] notify
    @ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:206 [inlined]
 [10] set_xlims!(C::Main.Tibra.Chart, xmin::Float32, xmax::Float32)
    @ Main.Tibra ~/src/tibra/Tibra.jl/src/tibrax_desktop/avalon_chart.jl:64

Somewhere you have an Observable{Nothing} and you trying to set it with a Vector{Float64}.

You can use ax.finallimits

For future reference: you may have been conditionally returning something in that lift statement. If you want to just listen and act, and not create an observable with whatever that do block returns, then use on or onany (for multiple observable inputs)!