From c76c26309985b2f07b5c852e9402ee8eda34baa1 Mon Sep 17 00:00:00 2001 From: InternetAstronaut <87543901+InternetAstronaut@users.noreply.github.com> Date: Sun, 21 Jun 2026 18:31:45 -0300 Subject: [PATCH 1/2] fixed problem where objects could be added with incorrect identifiers Signed-off-by: InternetAstronaut <87543901+InternetAstronaut@users.noreply.github.com> --- engine/src/base/Base.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engine/src/base/Base.js b/engine/src/base/Base.js index 124ae6d0d..8d34d4022 100644 --- a/engine/src/base/Base.js +++ b/engine/src/base/Base.js @@ -518,6 +518,9 @@ Wick.Base = class { this._children = []; } + // Fix for #142 + child.identifier = this._getUniqueIdentifier(child.identifier); + child._parent = this; child._setProject(this.project); @@ -541,6 +544,8 @@ Wick.Base = class { insertChild(child, index) { var classname = child.classname; + child.identifier = this._getUniqueIdentifier(child.identifier); // fix for the 3 people who have used this. + if (child._parent === this) { let result = 0; let old_index = this._children.indexOf(child); @@ -590,6 +595,7 @@ Wick.Base = class { */ getLinkedAssets () { // Implemented by Wick.Frame and Wick.Clip + console.warn(`getLinkedAssets() is implemented by Wick.Frame and Wick.Clip, but this is object is a Wick.${this.classname}.`) return []; } From 5c6d9e51c9ad47390d401bea275a265c944b21ad Mon Sep 17 00:00:00 2001 From: InternetAstronaut <87543901+InternetAstronaut@users.noreply.github.com> Date: Sun, 28 Jun 2026 12:49:44 -0300 Subject: [PATCH 2/2] Created _'quick'_ version of `_getUniqueIdentifier` which doesn't recursively call itself --- engine/src/base/Base.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/engine/src/base/Base.js b/engine/src/base/Base.js index 8d34d4022..2381d68e8 100644 --- a/engine/src/base/Base.js +++ b/engine/src/base/Base.js @@ -512,6 +512,7 @@ Wick.Base = class { * @param {Wick.Base} child - the child to add. */ addChild(child) { + if(!(child instanceof Wick.Base)) throw new TypeError("Child isn't a valid wick object."); var classname = child.classname; if (!this._children) { @@ -519,7 +520,7 @@ Wick.Base = class { } // Fix for #142 - child.identifier = this._getUniqueIdentifier(child.identifier); + child.identifier = this._getUniqueIdentifierQuick(child.identifier); child._parent = this; child._setProject(this.project); @@ -542,9 +543,10 @@ Wick.Base = class { * @returns {boolean} - true if an item before index was moved */ insertChild(child, index) { + if(!(child instanceof Wick.Base)) throw new TypeError("Child isn't a valid wick object."); var classname = child.classname; - child.identifier = this._getUniqueIdentifier(child.identifier); // fix for the 3 people who have used this. + child.identifier = this._getUniqueIdentifierQuick(child.identifier); // fix for the 3 people who have used this. if (child._parent === this) { let result = 0; @@ -653,6 +655,17 @@ Wick.Base = class { } } + _getUniqueIdentifierQuick(identifier) { + var cnames = this.getChildren().map(c => c.identifier); + var matching = cnames.filter(n => n.includes(identifier)) + + if(this._identiferNameIsPartOfWickAPI(identifier) || this._identifierNameExistsInWindowContext(identifier) || matching.length > 0) { + return identifier + '_copy'.repeat(matching.length + 1); + } else { + return identifier; + } + } + _identifierNameExistsInWindowContext(identifier) { if (window[identifier]) { return true;