File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -91,13 +91,17 @@ class ClusterFile {
9191 * The current instance of the cluster file.
9292 * This instance is used to track the changes provided by the user.
9393 */
94- static XMLCurrentInstance : XMLConfigurator = defaultXMLConfigurator ;
94+ static XMLCurrentInstance : XMLConfigurator = deepClone (
95+ defaultXMLConfigurator
96+ ) ;
9597
9698 /**
9799 * The base instance of the cluster file.
98100 * This instance is used to compare the changes with the original file to generate the cluster extension.
99101 */
100- static XMLBaseInstance : XMLConfigurator = defaultXMLConfigurator ;
102+ static XMLBaseInstance : XMLConfigurator = deepClone (
103+ defaultXMLConfigurator
104+ ) ;
101105
102106 static XMLDefaultInstance : XMLConfigurator = deepClone (
103107 defaultXMLConfigurator
Original file line number Diff line number Diff line change 66
77import ClusterFile from '../Components/ClusterFile' ;
88import eventEmitter from '../Components/EventEmitter' ;
9+ import { deepClone } from '../Components/Utils' ;
910import { defaultXMLConfigurator , defaultXMLFile } from '../defaults' ;
1011import { XMLExtensionConfigurator } from '../defines' ;
1112
@@ -17,12 +18,12 @@ import { XMLExtensionConfigurator } from '../defines';
1718 * @returns {void }
1819 */
1920export const resetClusterFileState = ( ) : void => {
20- // Reset instances to defaults (using direct reference to preserve HexString instances )
21- ClusterFile . XMLCurrentInstance = defaultXMLConfigurator ;
22- ClusterFile . XMLBaseInstance = defaultXMLConfigurator ;
21+ // Reset instances to defaults (using deep clones to avoid reference sharing )
22+ ClusterFile . XMLCurrentInstance = deepClone ( defaultXMLConfigurator ) ;
23+ ClusterFile . XMLBaseInstance = deepClone ( defaultXMLConfigurator ) ;
2324
2425 // Reset file to default structure
25- ClusterFile . file = defaultXMLFile ;
26+ ClusterFile . file = deepClone ( defaultXMLFile ) ;
2627
2728 // Clear extension file (no default available in defaults.ts)
2829 ClusterFile . extensionFile = { } as XMLExtensionConfigurator ;
You can’t perform that action at this time.
0 commit comments