Skip to content

Commit

Permalink
Allow disabling model storage
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary committed Jan 25, 2024
1 parent 36829f5 commit 17bc484
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Stipple"
uuid = "4acbeb90-81a0-11ea-1966-bdaff8155998"
authors = ["Adrian <[email protected]>"]
version = "0.27.33"
version = "0.27.34"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Stipple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down

2 comments on commit 17bc484

@essenciary
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/99504

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.27.34 -m "<description of version>" 17bc48413fab4ea3c9330bed03c87cea4827ed00
git push origin v0.27.34

Please sign in to comment.