EnablePersistence not working for TreeView in 29.1.33

We're using a TreeView with EnablePersistence on. When the component loads, we set expanded/collapsed state based on some business logic, and the TreeView displays it correctly. However, when the page re-renders or is reloaded, all nodes are collapsed. No Collapse events are triggered, so we're not able to cancel them.

This was working previously (in version 28.2.9), but updating to 29.1.33 appears to have broken it. Could you look into this and let me know if you can reproduce it?

Thanks,

-Austin Smith


4 Replies

LD LeoLavanya Dhanaraj Syncfusion Team April 4, 2025 11:11 AM UTC

Hi Austin,


Greetings from Syncfusion support.


With the details you provided, we have prepared and validated the mentioned EnablePersistence TreeView issue on our end using the latest version (29.1.35). However, we are unable to replicate the issue with our sample. We attempted to reproduce the problem by reloading the page and component, opening the URL in another tab, and in different browsers (Chrome, Edge, and Firefox) too. However, the issue does not occur, and the TreeView state is maintained correctly.


For your reference, we have included the sample and video footage. Please check this on your end and if you are still experiencing issues with the TreeView expand/collapse state persistence, we need additional details regarding the TreeView component rendering, such as the datasource type (either local data or remote data) and the method of binding the datasource to the component. Additionally, let us know if there are any customizations made during the component rendering or within any events. If possible, replicate the issue in our shared sample with the video footage. This information will help us validate the problem and provide a prompt solution.


Regards,

Leo Lavanya Dhanaraj


Attachment: TreeView_persistence_ec6798d5.zip


AS Austin Smith April 4, 2025 12:57 PM UTC

Thanks. On further investigation, it appears that some of the non-collapsed nodes in my treeview are incorrectly being drawn in the collapsed state when the component reloads. I'll see if I can reproduce this in the example you've provided.



AS Austin Smith April 4, 2025 03:12 PM UTC

Hello-

I haven't yet been able to replicate the issue in the sample application, but by comparing the code from the two versions (28.2.9 and 29.1.33), I've determined that the change which leads to the bug in



LD LeoLavanya Dhanaraj Syncfusion Team April 7, 2025 10:40 AM UTC

Hi Austin,


We suspect that the issue may be occurring on your end due to a cache problem when upgrading the packages. The issue does not occur with our shared Blazor TreeView component, which you have already tried on your end too. Therefore, we recommend that you clear your NuGet cache as described in the knowledge base article linked below and ensure that you are using the latest package versions.


https://support.syncfusion.com/kb/article/6265/how-to-clear-nuget-cache?isInternalRefresh=False


Additionally, we would like to inform you that the state of a component will be retained during navigation or refresh based on the ID. Therefore, please ensure that you set an ID for the component to store its state in the browser.


Common state persistence documentation : https://blazor.syncfusion.com/documentation/common/state-persistance


If still issue occurs on your end, please get back to us with our required details. We will be happy to assist you.


Loader.
Up arrow icon