diff --git a/Project.toml b/Project.toml index ac89aca..c1576fc 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Stipple" uuid = "4acbeb90-81a0-11ea-1966-bdaff8155998" authors = ["Adrian "] -version = "0.27.33" +version = "0.27.34" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/ReactiveTools.jl b/src/ReactiveTools.jl index de6f7f1..32d5fc4 100644 --- a/src/ReactiveTools.jl +++ b/src/ReactiveTools.jl @@ -588,7 +588,7 @@ macro init(args...) local new_handlers = false local initfn = - if isdefined($__module__, :init_from_storage) + if isdefined($__module__, :init_from_storage) && Stipple.USE_MODEL_STORAGE[] $__module__.init_from_storage else Stipple.init diff --git a/src/Stipple.jl b/src/Stipple.jl index 942d6fa..c169e5c 100644 --- a/src/Stipple.jl +++ b/src/Stipple.jl @@ -23,8 +23,8 @@ const USE_MODEL_STORAGE = Ref(true) Disables the automatic storage and retrieval of the models in the session. Useful for large models. """ -def disable_model_storage() - USE_MODEL_STORAGE[] = false +function enable_model_storage(enable::Bool = true) + USE_MODEL_STORAGE[] = enable end """ @@ -97,7 +97,7 @@ export setchannel, getchannel isempty(methods(notify, Observables)) && (Base.notify(observable::AbstractObservable) = Observables.notify!(observable)) include("ParsingTools.jl") -include("ModelStorage.jl") +USE_MODEL_STORAGE[] && include("ModelStorage.jl") include("NamedTuples.jl") include("stipple/reactivity.jl") @@ -367,7 +367,7 @@ function channeldefault(::Type{M}) where M<:ReactiveModel model_id = Symbol(Stipple.routename(M)) - ! USE_MODEL_STORAGE[] && return nothing + USE_MODEL_STORAGE[] || return nothing stored_model = Stipple.ModelStorage.Sessions.GenieSession.get(model_id, nothing) stored_model === nothing ? nothing : getfield(stored_model, Stipple.CHANNELFIELDNAME)