Hello. This is my first post. I am trying to observe changes made to my 'ItemList' using Mutation Observer. I'm injecting my code in Custom Code section of VEC. The observers are getting inititalized and my code works during edit Activity. But in the Activity preview it doesn't work and I am confused about this behavior. If you need any logs to further examine this, feel free to ask.
I am not able to do a code review, but one thing to check is the timing of the code delivery. When delivered to the page through the mbox, the code is probably loading at the top of the page and depending on which library you are using it might be before or after DOMContentLoaded. And in production, it might execute slightly differently from within the VEC. So, i would use additional console.log statements to see if things are actually firing when you think. For example, i see you are using event listeners for DOMContentLoaded which might not be behaving the way you think in the context of a normal page load with an mbox call. Let us know if this helps.