Skip to content

Commit 02a1481

Browse files
committed
push response item to dep_id_string sub-Dict
... when the `dep_id_string` is already present in the outer response Dict This makes callbacks with multiple output referencing the same component id update properly The failing test added in the previous commit is also fixed here
1 parent 04818ca commit 02a1481

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/handler/processors/callback.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ function _push_to_res!(res, value, out::Vector)
2020
_push_to_res!.(Ref(res), value, out)
2121
end
2222
function _push_to_res!(res, value, out)
23-
!(value isa NoUpdate) && push!(res,
24-
dep_id_string(out.id) => Dict(
25-
Symbol(out.property) => DashBase.to_dash(value)
26-
)
27-
)
23+
if !(value isa NoUpdate)
24+
id = dep_id_string(out.id)
25+
prop = Symbol(out.property)
26+
dashval = DashBase.to_dash(value)
27+
if haskey(res, id)
28+
push!(res[id], prop => dashval)
29+
else
30+
push!(res, id => Dict{Symbol, Any}(prop => dashval))
31+
end
32+
end
2833
end
2934

3035
_single_element_vect(e::T) where {T} = T[e]

test/callbacks.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ end
143143
Symbol("..input-two.placeholder...input-two.type.."),
144144
[(id = "input-two", property = "placeholder"),
145145
(id = "input-two", property = "type")],
146-
[(value = "text",)], [])[:response] == Dict("input-two" => Dict(:type => "text"))
146+
[(value = "text",)], [])[:response] == Dict("input-two" => Dict(:type => "text",
147+
:placeholder => "text ??"))
147148

148149
end
149150
@testset "callback! checks" begin

0 commit comments

Comments
 (0)