-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix the basic recursion error using setTimeout #1014
Fix the basic recursion error using setTimeout #1014
Conversation
Update the solution to improve render performance Use css to set the header size Fix the repeater's recursion error using setTimeout Fix the basic recursion error using setTimeout
@@ -638,7 +645,7 @@ | |||
callbacks[stage](null); | |||
} | |||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grunt is complaining about these unnecessary semicolons. There's another on line 650. Symptom of converting from the variable-declared functions I imagine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Just a typo
Tested this out, it allows for a HUGE number of rows to be rendered (I tried 10,000) which is pretty awesome. However, speed is significantly slower, even at 100 rows for example. Not sure if there's anything that can be done about that. |
I might be able to improve the speed a little without sacrificing too much. Let me take a look. For an average number of rows I felt like the difference wasn't very noticeable, and for large numbers the grid never worked in the first place, but I'll see if I can tweak slightly |
Updated. 10,000 rows might still be a bit slow but more typical numbers shouldn't suffer the same fate |
@@ -603,7 +609,13 @@ | |||
if(index<renderer.nested.length){ | |||
loopNested(cont, index); | |||
}else{ | |||
proceed('complete', args); | |||
if (++skip % 50 === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make this value a configurable option so that this can be optimized best for individual repeater performance. Perhaps a name like `recursionLimit' or something along those lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets wait on that to see if this can be done without recursion altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that we have an API that is based on callbacks for the render / sub-render steps. I tried a lot of different solutions but kept running into the same exponential growth because of that. Prior to realizing I could use setTimeout as a sort of trick/hack I was feeling like we were going to have to deprecate the API and start over (which might still be worthwhile but is obviously a breaking change)
Merging this interim solution for now. |
Fix the basic recursion error using setTimeout
Using setTimeout breaks up the call stack. This fixes #774