import { Component, StrictMode, useState, type ReactNode } from 'react'; import { createRoot } from 'react-dom/client'; import { ProbeMap } from './ProbeMap'; import './probe.css'; // A probe that white-screens teaches nothing: the run has to say *whose* bug it // was, ol-ext's or ours. This boundary keeps the error on the page so the gate // result stays attributable. class ErrorBoundary extends Component<{ children: ReactNode }, { error: Error | null }> { state: { error: Error | null } = { error: null }; static getDerivedStateFromError(error: Error) { return { error }; } render() { const { error } = this.state; if (!error) return this.props.children; return (

探针崩溃了

请把下面整段发给我 —— 它决定这次失败算谁的。

          {error.name}: {error.message}
          {'\n\n'}
          {error.stack}
        
); } } // The mount toggle exists so the React lifecycle question gets answered too: a // remount is *expected* to build a new Map, while dragging and re-rendering must // not. Gate 1 is about the latter. function Probe() { const [mounted, setMounted] = useState(true); return ( <> {mounted ? :

地图已卸载。重新挂载会构造新的 Map,这是预期行为。

} ); } createRoot(document.getElementById('probe')!).render( , );