Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Storybook Angular Custom Elements reload hack
* @hack detect when story is changed and reload because custom elements
* break HMR.
* Storybook will replace storybook-dynamic-app-root's children.
* Then we reload the page to redefine elements.
const rootEl = document.querySelector('#root');
rootEl.addEventListener('DOMNodeRemoved', (evt) => {
if (evt.relatedNode === rootEl) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment