You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 9, 2022. It is now read-only.
In cdf3d09 I've introduced a (failing, pending) test, which demonstrates how a shallow clone of the options object on Module instantiation might not be enough.
I noticed exactly this case in my app:
the options were defined in a JS object
a module was instantiated
a class was later added, and the module was rendered
the module was destroyed
a new module, using the same original JS object for config, inherited the additional class
This can so easily cause bugs which are hard to pin down, as it'll depend on a previous sequence of events. In my example, if an alert overlay was given a 'loading' class, all future alert overlays would also get that class.
Options to resolve this include:
I ensure the JS object is initialised fresh for every instantiation, or is deep-cloned prior to being used each time
Each of the non-scalar components of the options object (classes, helpers, template, model, data, children) are shallow-cloned during Module#_configure. This won't help much though, as child elements will still be references.