-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extremely high number of refreshes/recalc on dxDataGrid #839
Comments
Here is a fixed version of your example: Seems like it's your fault for triggering all those change detection calls, not DevExtreme. |
Your fix still doesn't work when I use Also, my sample was a simplyfied version of my problem. In the sample I have the 'server' available in the same component as the grid is running up. In my real application its not. That is the reason I passed it in via a closure. Also, can you explain to me where I was causing all those CD calls? As I'm not changing ANY data, I'm unaware how I can prevent those. The functions I used are 100% pure. I just hooked them up, following the documentation of DevExtreme. |
Every time your "getDbName(servers)" returns a new closure change detection is triggered. |
Why is it executed more as once? I know it returns a new closure. But the function should only be called once. All the content that is displayed is static. So no CD should be triggered. Also, that doesn't cure the 'calculateCellValue` version of my issue. |
Ok, so "calculateDisplayValue" issue is explained in "devextreme-angular" README (Angular Change Detection section). What's the issue with "calculateCellValue" I'm not sure. There was some similar issue before but it was fixed in 18.1.4 and I personally don't experience any issues with it in a project were we use 18.1.5. |
It seems their official example is also calling "calculateCellValue" few times too many. |
Hmm, another thing., I changed the detection mode to The click also fails in the |
There is something wrong with "calculateCellValue". You should create a new bug report specifically for it. "calculateDisplayValue" you used in your original example, seems to be working fine. |
"onRowClick" seems to be fine from what I can see: |
I have replaced the getDbname with a function that has a static return. Added some logging to it. |
Your assignment "this.serverList = servers" is triggering it. |
Ok here is my original sample with an alert instead of a console.log. The alert is never triggered for me. And here is the other sample, that doesn't assign this.serverList more than once. Still, the getDbName is triggered over and over again. I'm not trying to be a PITA, I just want to get to the bottom of this. I want to understand what is happening. |
Hello, |
@ovchinnikov Thanks, that explains the behaviour with the numerous calls. So the global event listeners in DX will make this pattern a no-go. That's a pity. Can you also explain why the alert is not fireing in my sample? |
@SanderElias The getDbName function always returns a new function. So, on every change detection cycle, DataGrid repaints its rows. This means that the mousedown event occurs on one DOM element and the mouseup event occurs on another. That is why the click event is not raised. |
@ovchinnikov Thanks. I now understand the problem in full. There is no error, nor a solution. The way DX works prevents this pattern. |
To help us process the issue more efficiently, please provide the following information:
Angular 6.1.2, devExtreme 18.1.5
I build this stackblitz to illustrate issue #838. I'm reusing it here to show the large amounts of calls to helper functions and the number unneeded rewrites to the screen.
When you take a look at the console.log, you will see that there are at least 10 calls to the
getDbName
function, for every event that fires. Just clicking outside the grid will even trigger this.This is causing speed issues in real applications. Is there a way I can prevent this?
[x ] bug Report
[ ] feature request
[ ] support inquiry
The text was updated successfully, but these errors were encountered: