mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-02-02 02:56:44 +00:00
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:
@@ -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] || "",
|
||||
|
||||
10
editions/tw5.com/tiddlers/releasenotes/5.4.0/#9494.tid
Normal file
10
editions/tw5.com/tiddlers/releasenotes/5.4.0/#9494.tid
Normal 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.
|
||||
Reference in New Issue
Block a user