construct-ui
construct-ui copied to clipboard
Toast included in view() does a redraw when it's removed from DOM
Including a toaster in view() causes a redraw when it's removed from the DOM. Note in the code sample below I don't actually use the Toaster.
I'm pretty sure this isn't a bug, but was something that was unexpected. I've had a look at Toaster.js and Overlay and it all looks fine. No action necessary.
const {
Toaster,
} = CUI;
const toaster = new Toaster();
const ToasterMultipleViewsSister = {
view: () => {
console.log('ToasterMultipleViewsSister.view');
return [
m(m.route.Link, { href: '/' }, 'Default'),
];
},
};
const ToasterMultipleViews = {
view: () => {
console.log('ToasterMultipleViews.view');
return [
m(toaster),
m(m.route.Link, { href: '/sister' }, 'Sister'),
]
},
};
document.addEventListener('DOMContentLoaded', () => {
m.route(document.body, '/', {
'/': ToasterMultipleViews,
'/sister': ToasterMultipleViewsSister,
});
});