tiddly-gittly / tw-echarts

An All-in-one Visualization Framework for TiddlyWiki5 based on ECharts
https://tiddly-gittly.github.io/tw-echarts/
MIT License
47 stars 8 forks source link

LazyLoad chartdata with <$echarts $text={{LazyLoadExampleOfTextData}}/> #84

Open Drevarr opened 1 year ago

Drevarr commented 1 year ago

I have 15,380 ChartData tiddlers that originally were type application/javascript that I realized didn't need to be marked because they are static charts generated upstream in python. I was hoping to take advantage of my currently lazyload configuration and reduce the 100mb initial size back down to <10mb.

However, the widget <$echarts $text={{LazyLoadExampleOfTextData}}/> doesn't appear to handle lazyloading of the tiddlers.

errors thrown: TypeError: this.getAttribute(...) is null TypeError: parent is undefined

Is there a way to handle lazyloading of the ChartData tiddlers to the $echart widget?

Drevarr commented 1 year ago

Believe this is fixed on TW side. Need to update my server to test.

https://talk.tiddlywiki.org/t/text-and-skinny-tiddler-and-echarts-oh-my/7044/2?u=john.edw_gmail.com

Drevarr commented 1 year ago

$text widget now works with lazyload tiddlers latest github master, but the macro still fails. Instead of a pop up error as before I now get an error in place of the chart.

image

Drevarr commented 1 year ago

In widget.ts:

I see $tw.wiki.getTiddler(this.tiddlerTitle) called on type === 'text/vnd.tiddlywiki'

while $tw.wiki.getTiddlerText(this.tiddlerTitle)is called on type === 'application/json'

if a text/vnd.tiddlywiki tiddler is tiddler.fields._is_skinny then $tw.wiki.getTiddler only returns the skinny fields.

$tw.wiki.getTiddlerText would trigger a load of the full tiddler text. Is this why lazy loaded tiddlers are failing with <$echarts $text={{LazyLoadExampleOfTextData}}/>

Drevarr commented 1 year ago

I reverted back to v0.0.9 and no longer have issues lazyloading of the text/vnd.tiddlywiki tiddlers for chart data.

Not sure what all I lost from the current release, However I reduced initial load size from 70+mb uncompressed to 7mb.

Gk0Wk commented 11 months ago

I tried to add lazy loading support for $tiddler as well in 0.2.5, the macro issue is still being troubleshooted : )