From 844564180f466f2e1545d579d19c38e7f8836fd1 Mon Sep 17 00:00:00 2001 From: yaisog Date: Tue, 20 Jan 2026 11:24:56 +0100 Subject: [PATCH] Fix LetWidget to always set all staged variables on first render (#9494) * Always set all staged variables on first render * Add changenote --- core/modules/widgets/let.js | 5 ++--- editions/tw5.com/tiddlers/releasenotes/5.4.0/#9494.tid | 10 ++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 editions/tw5.com/tiddlers/releasenotes/5.4.0/#9494.tid diff --git a/core/modules/widgets/let.js b/core/modules/widgets/let.js index b09c67e91d..6ede8b1dd3 100644 --- a/core/modules/widgets/let.js +++ b/core/modules/widgets/let.js @@ -7,7 +7,6 @@ This widget allows defining multiple variables at once, while allowing the later variables to depend upon the earlier ones. ``` -\define helloworld() Hello world! <$let currentTiddler="target" value={{!!value}} currentTiddler="different"> {{!!value}} will be different from <> @@ -56,7 +55,7 @@ LetWidget.prototype.computeAttributes = function() { }); // Run through again, setting variables and looking for differences $tw.utils.each(this.currentValueFor,function(value,name) { - if(!$tw.utils.isArrayEqual(self.attributes[name],value)) { + if(self.attributes[name] === undefined || !$tw.utils.isArrayEqual(self.attributes[name],value)) { self.attributes[name] = value; self.setVariable(name,value); changedAttributes[name] = true; @@ -68,7 +67,7 @@ LetWidget.prototype.computeAttributes = function() { LetWidget.prototype.getVariableInfo = function(name,options) { // Special handling: If this variable exists in this very $let, we can // use it, but only if it's been staged. - if ($tw.utils.hop(this.currentValueFor,name)) { + if($tw.utils.hop(this.currentValueFor,name)) { var value = this.currentValueFor[name]; return { text: value[0] || "", diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9494.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9494.tid new file mode 100644 index 0000000000..1729257323 --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9494.tid @@ -0,0 +1,10 @@ +title: $:/changenotes/5.4.0/#9494 +description: Fix LetWidget to always set all staged variables on first render +release: 5.4.0 +tags: $:/tags/ChangeNote +change-type: bugfix +change-category: widget +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9494 +github-contributors: yaisog + +This PR corrects a bug where the LetWidget did not set variables if their value was the empty output of a filtered transclusion.