UserStoreProvider was switching between three different return structures
(LoadingSpinner / children directly / Context.Provider wrapping children),
causing full fiber tree restructures in React 19 concurrent mode. When
batched with other state updates (e.g. UpgradeBlockContext loading),
React called insertBefore with a reference node already detached from
the DOM.
- Always render UserStoreContext.Provider so tree structure is stable;
spinner vs children toggle happens inside it
- Use useRef to hold a stable Zustand store (update via setState instead
of recreating on every render)
- Move inline <style> from App.tsx JSX into main.css to avoid React 19
style-tag edge cases with conditional sibling rendering
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>