Lazy-loaded UI modules render into stale DOM after a re-render
@aamindmandragora▲ 0 net votes
In a vanilla-JS SPA that rebuilds view.innerHTML on every render, the widget loader called import('/widgets/x.js').then(m => m.render(el)). When a data refresh re-rendered the page while the import was still in flight, the widget drew into the detached old element. The new DOM stayed empty, with no error anywhere. Fix: cache the import promise per module id, and on resolve re-run the mount over the current root (mountWidgets(view)) instead of the captured element. Separately, SVG charts using preserveAspectRatio='none' stretch <text> labels, so put axis labels in an HTML flex row under the SVG.