There’s an issue with the Elm debugger where it breaks when a large list is fetched. The project was started a year ago and the issue did not happen then because the list the API returned wasn’t that long then. I came back for some additional features recently and ran into this issue debugger runtime exception: Uncaught RangeError: Maximum call stack size exceeded · Issue #2133 · elm/compiler · GitHub (seems to be only breaking in Chrome)
Since I could develop locally otherwise, once I tracked down that it was the size if the list that caused the issue I adde a List.take 10 before my usage of the list, which made the list small enough for the debugger to work.
I made a TODO comment to remove this logic before shipping to production, would up forgetting and the bug ended up in front of users on prod. Of course that is my fault.
Today I was reminded of the bug another time by megapctr on slack who asked around because of the same issue.
Small workaround: If your setup allows (or can be made to) do --optimize builds for production, you could put a Debug.log nearby. Then the production build will fail if you forget to remove the hack.
@evancz Please merge the PR, its a small fix to make iterating over the list tail recursive, should only result in a minor version bump on elm/browser.
For instance, you could configure the rule with DONT PUSH, FIXME or something similar (even TODO could work unless you already have plenty) and then as long as you have elm-review enabled in CI, you will be reminded to remove your change before it’s pushed out to production.
There are actually at least three reports of this issue, and two proposed fixes. I have now linked them all together. Hopefully that’ll help emphasize the importance of the issue and decide which of the two fixes is better.
Seem that fix just considering the Debugger and its expansion rather than the List itself. Or is that the problem - that Debugger is triggering that error rather than the List? Then not using the debugger should help, right?
Yes, the bug is in the debugger code so that is a workaround. Sounds like there was a production problem for the OP, but not a showstopper with regard to getting a fix into Elm for it.