Stipple.jl
Stipple.jl copied to clipboard
Using @init in module scope causes error with Genie.loadapp()
trafficstars
I have an app where I want to sync the UI across multiple users, so I'm using the @initmacro. When launching the app with
using GenieFramework; Genie.loadapp(); up()
I'm getting this error:
Active env: DEV
Loading appERROR: [ Info: 2023-07-18 23:06:58 Watching ["/Users/pere/genie/mwes"]
MethodError: no method matching __GF_AUTO_HANDLERS__(::Main.App.var"##Main.App_ReactiveModel!#375")
Stacktrace:
[1] invokelatest(f::typeof(Main.App.__GF_AUTO_HANDLERS__), args::Tuple{Main.App.var"##Main.App_ReactiveModel!#375"}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base essentials.jl:816
[2] invokelatest(f::typeof(Main.App.__GF_AUTO_HANDLERS__), args::Tuple{Main.App.var"##Main.App_ReactiveModel!#375"})
@ Base essentials.jl:813
[3] top-level scope
@ ~/.julia/packages/Stipple/a9IBQ/src/ReactiveTools.jl:541
in expression starting at /Users/pere/.julia/packages/Stipple/a9IBQ/src/ReactiveTools.jl:541
Still, the app works fine despite this error. Starting the app with include does not yield an error. This is the code:
module App
using GenieFramework
@genietools
@app begin
@out toggle_list = ["red", "green", "yellow"]
@in indiv = false
@in toggle_states = []
end
model = @init
@page("/", "toggles.jl.html")
@page("/shared", "toggles.jl.html", Stipple.ReactiveTools.DEFAULT_LAYOUT(), model)
end
<div v-for="toggle in toggle_list">
<q-toggle v-model="toggle_states" :label="toggle" :val="toggle" />
</div>
<q-toggle v-model="indiv" />
{{toggle_states}}
{{indiv}}