Appending a Vue component not working
Bug Description
I'm prototyping out an addon. Part of this addon means adding a Vue component to every page in the Control Panel. I found the documentation around appending components. However, this does not seem to work and throws console errors.
After some digging, it turns out $root is null in here, not sure why but it is.
https://github.com/statamic/cms/blob/a074abbe6f6a234e5220889a7a8ea9df46656d6e/resources/js/components/Components.js#L17
I managed to find a workaround for now though - basically just doing what the helper does but on Statamic.app instead.
Statamic.$app.data.appendedComponents.push(new Component(`appended-zippy`, 'zippy', {}))
How to Reproduce
- Attempt to append a component to the CP
Statamic.$components.append('zippy', {
props: {}
})
- Hook up your script in your service provider
- In the CP, open up the console and see red errors
Extra Detail

Environment
Statamic 3.0.49 Pro (pretty sure I'm on a way newer version than this but my sandbox site is all messed up)
Laravel 8.43.0
PHP 8.0.3
doublethreedigital/duplicator 1.3.2
doublethreedigital/static-cache-manager dev-master
doublethreedigital/zippy dev-master
Hi Duncan,
I was running into the same kind of issue and noticed that I was appending the component at the wrong place. You'll have to append the component in the 'booted()' function.
import MyComponent from './components/MyComponent.vue'
Statamic.booting(() => {
Statamic.$components.register('my-component', MyComponent);
})
Statamic.booted(() => {
const component = Statamic.$root.$components.append('my-component', {
props: { foo: 'bar' }
});
})
Closing as I believe @Djoul 's explanation is correct. Let us know otherwise, Duncan.