TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.97k stars 1.18k forks source link

[BUG] Export all on tiddlywiki.com 5.3.0 hangs the browser #7592

Closed btheado closed 1 year ago

btheado commented 1 year ago

Describe the bug

Invoking the export all function on tiddlywiki.com 5.3.0 hangs the browser.

Expected behavior

It should export in under a second like it did in 5.2.7

To Reproduce

  1. Go to tiddlywiki.com
  2. Click on the tools sidebar tab
  3. Click the export all button and choose json (I didn’t try the others)
  4. The browser is hung

Screenshots

No response

TiddlyWiki Configuration

tiddlywiki.com 5.3.0, firefox, linux. Others have duplicated on other OS.

Additional context

Git bisect points the finger at this commit: https://github.com/Jermolene/TiddlyWiki5/pull/6666/commits/ec1ec8ccd8942adb33f6aa148219bc7759c0bca7. Go one commit earlier and the misbehavior is not there.

This issue was originally reported at https://talk.tiddlywiki.org/t/export-all-hangs-browser-in-5-3-0/7496/

kookma commented 1 year ago

For me, it takes a rather more time comparing to 5.2.7 with several times seeing not-responding alert. Windows 10, Chrome 113, TW 5.3.0 (tiddlywiki.com)

kookma commented 1 year ago

More info: I tried to export all to a JSON. The browser shows not-responding alert two times, and I clicked wait quickly after seeing the alert. It took 52 seconds to show the download message and successfully download the tiddlers as JSON.

Jermolene commented 1 year ago

Thank you @btheado @kookma I'm investigating this now. One curious thing is that the changes in ec1ec8ccd8942adb33f6aa148219bc7759c0bca7 have all been overwritten by subsequent changes. Very peculiar.

btheado commented 1 year ago

One curious thing is that the changes in ec1ec8c have all been overwritten by subsequent changes. Very peculiar.

The difference I saw when stepping through getTransclusionTarget is that this.wiki.parseText is getting called (unnecessarily?) when it is slow/hung. Before the above commit, the jsontiddlers macro output was not being passed to parseText.

Jermolene commented 1 year ago

The difference I saw when stepping through getTransclusionTarget is that this.wiki.parseText is getting called (unnecessarily?) when it is slow/hung. Before the above commit, the jsontiddlers macro output was not being passed to parseText.

Thank you! The excessive parsing is consistent with what I've seen with the developer tools performance tab, but I hadn't clicked that what's going on is that the output of the jsontiddlers macro is being parsed.

Jermolene commented 1 year ago

I think that the underlying problem is that the transclude widget unnecessarily parses the target text even if the $output attribute is set to text/raw, and the parse results are discarded. This happens within the JSON exporter here.

Jermolene commented 1 year ago

Closed in error by previous commit

Jermolene commented 1 year ago

The fix in #7647 has now been merged, and can be tested at https://tiddlywiki.com/prerelease/