josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON
https://jsoneditoronline.org
Other
818 stars 108 forks source link

"TypeError: N is not a function" when trying to open transform modal #301

Closed LoganGrasby closed 7 months ago

LoganGrasby commented 10 months ago

This error is reproducible in the demo as well at https://jsbin.com/gatibux/edit?html,output

I have been using the vanilla js version through the CDN and noticed this issue beginning 2-3 days ago. I've also noticed that larger files now cause the page to crash, but it's unclear if that is related to this error. Previously the same files could be imported without issue. I noticed both issues around the same time and I have only used the editor through the CDN (same CDN url as the demo above).

Also, this is an amazing project thank you for sharing your work!

josdejong commented 10 months ago

Ouch! That is an ugly regression, introduced in v0.17.9, two days ago. Fixed now in v0.17.10.

Thanks for your kind words, glad you like the editor 😄.

LoganGrasby commented 10 months ago

Thanks! Seems to be working now. I'm still experiencing the issue with the page crashing with large files so it seems to be unrelated. It's a bit difficult to diagnose as my browser crashes immediately after trying to load the editor with a file larger than ~10mb. I was definitely able to load the file in question a few days ago. I'm importing from 'https://unpkg.com/vanilla-jsoneditor/index.js'. Any idea what the issue might be?

josdejong commented 10 months ago

Hm, I've tested with some files ranging from 20MB to 415MB and these still work smooth. How can I reproduce the issue you're encountering with this ~10MB file?

LoganGrasby commented 10 months ago

Hmm I've been testing this for some time and I haven't been able to figure out what the issue is. All I can tell right now is that the main thread appears to be getting blocked with larger file sizes until eventually the page crashes. At just under 10mb the page will become unusable for a moment but eventually unblock once the table renders. I'm loading the file in table mode if that makes a difference? I have text set to undefined. I prepare files in advance with papaparse. I was wondering if I might have introduced a conflict somehow there. I wish I could be more helpful. Feel free to close if there's nothing obvious I should try as it might be an issue on my end.

josdejong commented 10 months ago

Is it possible to share the JSON file that gives troubles? If not public, you can email it to me privately? If the latest version of the editor has a regression in the performance I would love to know.

josdejong commented 10 months ago

And on a side note: I recently wrote a CSV parser myself because I couldn't use papaparse or other popular CSV libaries, it may be interesting to you, see https://github.com/josdejong/csv42.

LoganGrasby commented 10 months ago

Thanks! I'll send you an email with the file.

josdejong commented 10 months ago

For others: the issue with table mode being slow was caused by the editor not having a fixed height. That forces the editor to render all rows (which is slow for large documents). When the editor has a fixed height, it will only render the visible rows.