Welcome to the JavaScript feedback portal. We’re happy you’re here! If you have feedback on how to improve the JavaScript, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
I'm resubmitting a previous feature request because I've found how the feature can be easily implemented.
Could a way to manually set the persistence version for all components be added when enabling version-based persistence?
I can see in the documentation how to enable version-based persistence (link), but there is no way to set the default version.
The problem I'm running into is that I have multiple environments for the same web application all running on the same domain name, but with a different path (ex. mycompany.com/MyAppDev, mycompany.com/MyAppTest, mycompany.com/MyApp). Because these applications are all under the same domain name, the persistence data in local storage is getting contaminated when working in the different environments.
Rather than turning on version-based persistence and then having to set the persistence version in every single component I'm using throughout the web application, could the ej.base.enableVersionBasedPersistence(true) method be modified to all for an additional parameter that sets the persistence version for all components (ex. ej.base.enableVersionBasedPersistence(true, 'development'))?
I made 6 simple changes in @syncfusion/ej2-base/src/[email protected] and was able to achieve the desired functionality in the feature request. The changes I made are on the following lines in the attached component.txt file:
I simply created an undefined variable named "defaultStatePersistenceVersion" and added an additional parameter to the "enableVersionBasedPersistence" function that would set that new variable. Then, anywhere we check to see if "versionBasedStatePersistence" is true / enabled, I coalesce the component's "ej2StatePersistenceVersion" and the "defaultStatePersistenceVersion". If no ej2StatePersistence version has been set for the component, it will fall back and use the defaultStatePersistenceVersion.