diff --git a/src/ReactiveTools.jl b/src/ReactiveTools.jl index 3350375..eda58fa 100644 --- a/src/ReactiveTools.jl +++ b/src/ReactiveTools.jl @@ -1055,22 +1055,14 @@ macro onchange(location, vars, expr) on_vars = fieldnames_to_fields(vars, known_vars) expr, used_vars = mask(expr, known_vars) - do_vars = Symbol[] - for a in vars.args - push!(do_vars, a isa Symbol && ! in(a, used_vars) ? a : :_) - end - - replace_reactive_vars = setdiff(known_reactive_vars, do_vars) - replace_non_reactive_vars = setdiff(known_non_reactive_vars, do_vars) - - expr = fieldnames_to_fields(expr, known_non_reactive_vars, replace_non_reactive_vars) - expr = fieldnames_to_fieldcontent(expr, known_reactive_vars, replace_reactive_vars) - expr = unmask(expr, vcat(replace_reactive_vars, replace_non_reactive_vars)) + expr = fieldnames_to_fields(expr, known_non_reactive_vars) + expr = fieldnames_to_fieldcontent(expr, known_reactive_vars) + expr = unmask(expr, vcat(known_reactive_vars, known_non_reactive_vars)) fn = length(vars.args) == 1 ? :on : :onany ex = quote - $fn($(on_vars.args...)) do $(do_vars...) + $fn($(on_vars.args...)) do _... $(expr.args...) end end