From d95b5689995ae852867f5c23ab12d6168cf02b89 Mon Sep 17 00:00:00 2001 From: Adrian Salceanu Date: Fri, 30 Aug 2024 17:08:22 +0200 Subject: [PATCH] v0.28.14 --- Project.toml | 4 ++-- src/ModelStorage.jl | 2 +- src/Stipple.jl | 6 ++++++ src/stipple/rendering.jl | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 2b1e73bb..4237bded 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Stipple" uuid = "4acbeb90-81a0-11ea-1966-bdaff8155998" -authors = ["Adrian "] -version = "0.28.13" +authors = ["Adrian and the Stipple contributors"] +version = "0.28.14" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/ModelStorage.jl b/src/ModelStorage.jl index ee709154..eb38fd34 100644 --- a/src/ModelStorage.jl +++ b/src/ModelStorage.jl @@ -35,7 +35,7 @@ function init_from_storage( t::Type{M}; Stipple.isprivate(f, model) || ! hasproperty(stored_model, f) || ! hasproperty(model, f) else # restore field value from stored model - (field[!] = getfield(stored_model, f)[]) + field[!] = getfield(stored_model, f)[] end # register reactive handlers to automatically save model on session when model changes diff --git a/src/Stipple.jl b/src/Stipple.jl index 5e0342fc..d74d46b3 100644 --- a/src/Stipple.jl +++ b/src/Stipple.jl @@ -728,6 +728,12 @@ function Base.push!(app::M, vals::Pair{Symbol,T}; channel::String = getchannel(app), except::Union{Nothing,UInt,Vector{UInt}} = nothing, restrict::Union{Nothing,UInt,Vector{UInt}} = nothing)::Bool where {T,M<:ReactiveModel} + try + use_model_storage() && Stipple.ModelStorage.Sessions.store(app) + catch ex + @error ex + end + try _push!(vals, channel; except, restrict) catch ex diff --git a/src/stipple/rendering.jl b/src/stipple/rendering.jl index a5a31d34..24290f46 100644 --- a/src/stipple/rendering.jl +++ b/src/stipple/rendering.jl @@ -148,7 +148,7 @@ function Stipple.render(app::M)::Dict{Symbol,Any} where {M<:ReactiveModel} js = join_js(f(app), ",\n "; pre = strip) isempty(js) || push!(vue, field => JSONText("{\n $js\n}")) end - + for (f, field) in ( (js_before_create, :beforeCreate), (js_created, :created), (js_before_mount, :beforeMount), (js_mounted, :mounted), (js_before_update, :beforeUpdate), (js_updated, :updated), (js_activated, :activated), (js_deactivated, :deactivated), @@ -207,3 +207,5 @@ quasar( function js_attr(x) Symbol(replace(replace(json(render(x)), "'" => raw"\'"), '"' => ''')) end + +Stipple.render(X::Matrix) = [X[:, i] for i in 1:size(X, 2)] \ No newline at end of file