Skip to content

Commit

Permalink
Model state persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary committed Dec 11, 2024
1 parent 281e2b2 commit 5f5ceeb
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/ReactiveTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -514,15 +514,18 @@ macro init(args...)
end

function init_model(M::Type{<:ReactiveModel}, args...; context = nothing, kwargs...)
m = parentmodule(M)
m = __module__ = parentmodule(M)

initfn = begin
if Stipple.use_model_storage() && $__module__ === Stipple
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
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
Expand Down

0 comments on commit 5f5ceeb

Please sign in to comment.