Skip to content

Commit

Permalink
fix: variables in functions should not pollute upstream widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
saqimtiaz committed Sep 27, 2024
1 parent bb75560 commit f343ccd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/modules/widgets/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ Widget.prototype.makeFakeWidgetWithVariables = function(variables) {
};
} else {
opts = opts || {};
opts.variables = $tw.utils.extend(variables,opts.variables);
opts.variables = $tw.utils.extend({},variables,opts.variables);
return self.getVariableInfo(name,opts);
};
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
title: Functions/FunctionFilterrunVariables4
description: Nested functions in filter runs that set variables should not pollute upstream widget tree
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]

title: Output

\function .a() [.b[]]
\function .b() [all[]] :map[subtract[1].c[]]
\function .c() [all[]] :map[subtract[1].d[]]
\function .d() [all[]] :map[subtract[1].e[]]
\function .e() [all[]] :map[subtract[1]]


<$text text={{{ [[10]] :map:flat[.a[]then<currentTiddler>] }}}/>

+
title: ExpectedResult

10

0 comments on commit f343ccd

Please sign in to comment.