Editable List View javascript error - Maximum call stack size exceeded

  • 11 February 2020
  • 2 replies
  • 112 views

We have an editable list view with an Add button on the button bar. If I add a row and edit it and leave the focus on one of the cells, and then click the "Add" button the app hangs. I checked the browser console and there is a JavaScript error: Uncaught RangeError: Maximum call stack size exceeded.


The only thing the Add button is doing is calling the K2 rule to add a new row to the editable list view. I can't find any custom JavaScript on our form and the js stack trace seems to be in the K2 code.

 

If I save the listview entirely and then click Add, I don't get this error and it adds the new row.

 

11401iA1C0428F2E843ED1.png

 

 


2 replies

Update: I've figured out that I can't call my unbound rules in the various listview events. I was trying to use them for validation and some of them have expressions in them. It makes me wonder what the point of those events are if I can't put anything in them, but I'm going to find another way to do do what I'm trying to do.

 

If anyone reading this has any idea where I can find solid documentation on the editable listview event lifecycle I'd love to see it. The documentation is really weak.

This error is almost always means you have a problem with recursion in JavaScript code, as there isn't any other way in JavaScript to consume lots of stack. Sometimes calling a recursive function over and over again, causes the browser to send you Maximum call stack size exceeded error message as the memory that can be allocated for your use is not unlimited. The solution is to wrap your recursive function call into a -


 



  • setTimeout

  • setImmediate or

  • process.nextTick


 


Also, you can localize the issue by setting a breakpoint on RangeError type of exception , and then adjust the code appropriately.


 

Reply