$text and skinny tiddler and echarts oh my

$text widget doesn’t appear to work with skinny tiddlers.

<$text text={{SomeSkinnyTiddler}}/> produces TypeError: text is null which I think is causing the inability to use the $echart widget with lazy loaded tiddlers.

Is there a method/work around to force getTiddler on the skinny to fully load?

echarts macro below:

title: $:/plugins/Gk0Wk/echarts/macro
type: text/vnd.tiddlywiki
tags: $:/tags/Macro

\define echarts(textortiddler,height:"300px",width:"100%",class:"gk0wk-echarts-body",theme:"auto",renderer:"canvas",fillSidebar:"true")
<$set name="textortiddler" value="""$textortiddler$""">
<$list filter="[<textortiddler>is[tiddler]] [<textortiddler>is[shadow]]">
<$echarts $tiddler=<<textortiddler>> $height="$height$" $width="$width$" $class="$class$" $theme="$theme$" $renderer="$renderer$" $fillSidebar="$fillSidebar$"/>
</$list>
<$list filter="[<textortiddler>!is[tiddler]!is[shadow]]">
<$echarts $text=<<textortiddler>> $height="$height$" $width="$width$" $class="$class$" $theme="$theme$" $renderer="$renderer$" $fillSidebar="$fillSidebar$"/>
</$list>
</$set>
\end

Thank you @john.edw_gmail.com I was able to duplicate this problem, and have just pushed a fix to the master branch.

1 Like

Thank you for the $text widget fix. Installed the latest from Master, can confirm it is working with skinny tiddlers, and lazy loading.

However, I am now getting an error with the echarts macro in place of the chart rather than the tiddlywiki popup error as before.
image

If I directly access SomeSkinnyTiddler then proceed to the tiddler with the <$echarts $text={{SomeSkinnyTiddler}} $height="600px" $theme="dark"/> the macro works as expected since the tiddler has been fully loaded.

Is there a tweak to the macro to ensure it loads appropriately?

\define echarts(textortiddler,height:"300px",width:"100%",class:"gk0wk-echarts-body",theme:"auto",renderer:"canvas",fillSidebar:"true")
<$set name="textortiddler" value="""$textortiddler$""">
<$list filter="[<textortiddler>is[tiddler]] [<textortiddler>is[shadow]]">
<$echarts $tiddler=<<textortiddler>> $height="$height$" $width="$width$" $class="$class$" $theme="$theme$" $renderer="$renderer$" $fillSidebar="$fillSidebar$"/>
</$list>
<$list filter="[<textortiddler>!is[tiddler]!is[shadow]]">
<$echarts $text=<<textortiddler>> $height="$height$" $width="$width$" $class="$class$" $theme="$theme$" $renderer="$renderer$" $fillSidebar="$fillSidebar$"/>
</$list>
</$set>
\end

Hi @john.edw_gmail.com I’m not familiar with the echarts widget, but I think that error message is generated by the widget because it is getting a blank value for its $text attribute and there is no $tiddler attribute.

One fix would be to change this line:

<$list filter="[<textortiddler>!is[tiddler]!is[shadow]]">

to:

<$list filter="[<textortiddler>!is[tiddler]!is[shadow]has[text]]">

When a lazy-loading wiki uses dynamic table or echarts, how can they trigger loading all tiddlers their filter needs?

Interestingly, I found that while the macro errors on initial display, if I return to the tiddler without reloading the wiki the chart will display. Seems like the macro is getting the full tiddler to load, just out of sequence/timing with the execution.

Hi @linonetwo transcluding a tiddler as an operand of a filter operator is enough to trigger a load of that tiddler. (The implementation calls wiki.getTextReference() which in turn calls wiki.getTiddlerText() which triggers the lazy loading).

Of course, as discussed above, it is necessary to make sure that the logic of the app works for tiddlers that haven’t yet been triggered for lazy loading, and thus have missing text fields…

The initial display is enough to trigger the lazy loading of the tiddler, which means things will work normally once it has loaded.

I thought lazy-all will even load tiddler metadata lazily. But acturally metadata is preloaded before loading single tiddler’s text. So dynamic table and echarts that shows metadata instead of text file works fine.

My wiki is now a lazy-loading nodejs wiki started by TidGi

http://wiki.onetwo.ren/ it loads dynamic table, and TheBrain in sidebar (using echarts) works fine.

The Brain JS is not lazyloading, as the tiddler $:/plugins/Gk0Wk/echarts/addons/TheBrain.js is type application/javascript which is fully loading per the $:/core/save/lazy-all

Can you make a VND/Tiddlywiki type chart data tiddler properly load in your lazyload config?

Any way to inject an earlier $list filter="[<textortiddler>is[tiddler]has:field[_is_skinny]]" to detect _is_skinny and force the full tiddler load? I thought $text was the culprit, but since the chartdata is in tiddlers I assume it passes the first filter and $tiddler just sets the currentTiddler and doesn’t force a full load of a skinny tiddler.