Tm-http-request crash tiddlywiki (fetching large json)

Hi, I’m trying to fetch data from this url in order to display compatibility data for css features: https://unpkg.com/@mdn/browser-compat-data/data.json

The data seems to be fetch correctly (I can log the variable data to the console), but when attempting to save the json in a tiddler, the wiki crash. Here’s my code:

\procedure fetch()
\procedure completion()
<$action-log data=<<data>>/>
<$action-setfield $tiddler="$:/state/browser-compat-data" text=<<data>>/>
\end completion
<$action-sendmessage
		$message="tm-http-request"
		url="https://unpkg.com/@mdn/browser-compat-data/data.json"
		method="GET"
		header-accept="application/json"
		bind-status="$:/temp/browser-compat-data/status"
		bind-progress="$:/temp/browser-compat-data/progress"
		oncompletion=<<completion>>
		onprogress=<<progress>>
		var-start=<<start>>
		var-limit=<<limit>>
	/>
\end fetch

<$button actions=<<fetch>>> fetch</$button>


bind-status="$:/temp/browser-compat-data/status"

{{$:/temp/browser-compat-data/status}}

---


bind-progress="$:/temp/browser-compat-data/progress"

{{$:/temp/browser-compat-data/progress}}

---

{{$:/state/browser-compat-data}}

Demo

It seems to run the wikitext parser on the result.

Try this for your completion procedure. It sets the type to text/plain, which does not try to wikify the results. It’s a 14MByte tiddler, which imo has to break the parser :slight_smile:

\procedure completion()
<$action-log data=<<data>>/>
<$action-setfield $tiddler="$:/state/browser-compat-data" text=<<data>> type="text/plain"/>
\end completion

type="application/json" seems to work too

2 Likes

Thanks a lot, it works perfectly now !