jacob-ebey / turbo-stream

A streaming data transport format that aims to support built-in features such as Promises, Dates, RegExps, Maps, Sets and more.
https://turbo-stream.pages.dev/
MIT License
196 stars 6 forks source link

Maximum call stack size exceeded #33

Closed lilouartz closed 2 months ago

lilouartz commented 5 months ago

I have a fairly complex JSON object structure that the server returns. You can see an example here:

https://pillser.com/probiotics/bifidobacterium-animalis

At the moment it is failing with:

Uncaught RangeError: Maximum call stack size exceeded
    at Object.er (turbo-stream.mjs:173:10)
    at Object.Qi (turbo-stream.mjs:322:22)
    at async Xi (turbo-stream.mjs:292:19)

It happened after I added additional nested json. Still figuring out how to fix it.

lilouartz commented 5 months ago

This is Remix response, if helpful https://gist.github.com/lilouartz/2a0df8ccb00584a93ba677e9b4a66929

jacob-ebey commented 5 months ago

Are you returning DB queries or something directly? That is a MASSIVE payload. I'll look into this when I have time, but for now, if I were you, I'd try my best to cut down the amount of data you are returning from your loaders by pre-processing the return. Your response is 4MB as is and you are 100% not SHOWING 4MB worth of data on the page you linked above.

carinakoo8 commented 4 months ago

I have run into this error as well with a large payload. The json structure of the data is relatively flat, something like

{ data: [
  { c0_column_name: 'web confirmation WR1767900' },
  { c0_column_name: 'web confirmation WR1767897' },
  { c0_column_name: 'web confirmation WR1767893' },
  { c0_column_name: 'web confirmation WR1767890' },
  { c0_column_name: 'web confirmation WR1767881' },
  { c0_column_name: 'web confirmation WR1767866' }
]}

It works after I cut the payload to about 2.5 MB. It would be great to have guidance on whether this can be expected to work with larger payloads!

jacob-ebey commented 2 months ago

Should be fixed in https://github.com/jacob-ebey/turbo-stream/releases/tag/v2.2.2