Fix LetWidget to always set all staged variables on first render (#9494)

* Always set all staged variables on first render

* Add changenote
This commit is contained in:
yaisog
2026-01-20 11:24:56 +01:00
committed by GitHub
parent a670de0e95
commit 844564180f
2 changed files with 12 additions and 3 deletions

View File

@@ -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 <<value>>
</$let>
@@ -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] || "",

View File

@@ -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.