1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-10 15:53:58 +00:00

Fix data widget not refreshing

This commit is contained in:
Jeremy Ruston 2024-05-07 18:33:53 +01:00
parent d5b7bc7d41
commit 83ebfc67fb
2 changed files with 30 additions and 4 deletions

View File

@ -134,10 +134,10 @@ DataWidget.prototype.extractCompoundTiddler = function(title) {
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
*/
DataWidget.prototype.refresh = function(changedTiddlers) {
// Refresh our attributes
var changedAttributes = this.computeAttributes();
// Refresh our children, and indicate that we refreshed if any of our attribute values have changed
return this.refreshChildren(changedTiddlers) || $tw.utils.count(changedAttributes) > 0;
// It would be expensive to calculate whether the changedTiddlers impact the filter
// identified by the $filter attribute so we just refresh ourselves unconditionally
this.refreshSelf();
return true;
};
exports.data = DataWidget;

View File

@ -0,0 +1,26 @@
title: TestCases/DataWidget/Refreshing
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
description: Refreshing the data widget
display-format: plaintext
title: Output
<$data title="Epsilon" text={{Subject}}/>
+
title: Subject
Nothing
+
title: Actions
<$action-setfield $tiddler="Subject" text="Theta"/>
+
title: ExpectedResult
<p>[
{
"title": "Epsilon",
"text": "Theta"
}
]</p>