Skip to content

Commit

Permalink
Fix session storage
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary committed Dec 11, 2024
1 parent 457c4aa commit 281e2b2
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/ReactiveTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -515,11 +515,20 @@ end

function init_model(M::Type{<:ReactiveModel}, args...; context = nothing, kwargs...)
m = parentmodule(M)
initfn = if isdefined(m, :init_from_storage) && Stipple.USE_MODEL_STORAGE[]
m.init_from_storage
else
Stipple.init

initfn = begin
if Stipple.use_model_storage() && $__module__ === Stipple
Stipple.ModelStorage.Sessions.init_from_storage
elseif isdefined($__module__, :Stipple) && isdefined($__module__.Stipple, :ModelStorage) && isdefined($__module__.Stipple.ModelStorage, :Sessions) && isdefined($__module__.Stipple.ModelStorage.Sessions, :init_from_storage) && Stipple.use_model_storage()
$__module__.Stipple.ModelStorage.Sessions.init_from_storage
elseif isdefined($__module__, :init_from_storage) && Stipple.use_model_storage()
$__module__.init_from_storage
else
Stipple.init
end
end


handlersfn = if context !== nothing && isdefined(M, :__GF_AUTO_HANDLERS__)
M.__GF_AUTO_HANDLERS__
else
Expand Down

0 comments on commit 281e2b2

Please sign in to comment.