fix(excalidraw): pin React 18.3.1 exact version (esm.sh was resolving to React 19)
CI / lint (push) Failing after 9s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / e2e (push) Has been skipped
CI / security (push) Successful in 13s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
CI / lint (push) Failing after 9s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / e2e (push) Has been skipped
CI / security (push) Successful in 13s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><meta charset="UTF-8"><title>Excalidraw Error Capture</title>
|
||||
<style>
|
||||
body { font-family:monospace; background:#1e1e1e; color:#ddd; padding:20px; }
|
||||
.pass { color:#4caf50; } .fail { color:#f44336; }
|
||||
pre { background:#2d2d2d; padding:10px; border-radius:4px; }
|
||||
#app { margin-top:20px; border:1px dashed #555; min-height:100px; padding:10px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Excalidraw Error Boundary Test</h2>
|
||||
<pre id="log"></pre>
|
||||
<div id="app"></div>
|
||||
|
||||
<script type="module">
|
||||
import React from "https://esm.sh/react@18";
|
||||
import ReactDOM from "https://esm.sh/react-dom@18/client";
|
||||
const log = document.getElementById('log');
|
||||
function add(msg, cls='') { log.innerHTML += `<span class="${cls}">${msg}</span>\n`; }
|
||||
|
||||
// Error boundary to catch rendering errors
|
||||
class ErrorBoundary extends React.Component {
|
||||
constructor(props) { super(props); this.state = { error: null }; }
|
||||
static getDerivedStateFromError(error) { return { error }; }
|
||||
componentDidCatch(error, info) {
|
||||
add(`✗ REACT ERROR CAUGHT: ${error.message}`, 'fail');
|
||||
add(` Stack: ${(error.stack||'').split('\n').slice(0,5).join('\n')}`, 'info');
|
||||
}
|
||||
render() {
|
||||
if (this.state.error) {
|
||||
return React.createElement('div', { style: {color:'red',padding:'20px'} },
|
||||
`Error: ${this.state.error.message}`
|
||||
);
|
||||
}
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
|
||||
add('Loading Excalidraw...');
|
||||
try {
|
||||
window.EXCALIDRAW_ASSET_PATH = 'https://esm.sh/@excalidraw/[email protected]/dist/prod/';
|
||||
const ExcalidrawLib = await import('https://esm.sh/@excalidraw/[email protected]');
|
||||
const { Excalidraw } = ExcalidrawLib;
|
||||
|
||||
add(`Excalidraw keys: ${Object.keys(ExcalidrawLib).slice(0,8).join(', ')}`, 'info');
|
||||
add(`Excalidraw itself: ${typeof Excalidraw}`, 'info');
|
||||
if (typeof Excalidraw === 'function') {
|
||||
add(` .displayName: ${Excalidraw.displayName || 'none'}`, 'info');
|
||||
add(` .name: ${Excalidraw.name || 'none'}`, 'info');
|
||||
}
|
||||
|
||||
// Try rendering with error boundary
|
||||
const root = ReactDOM.createRoot(document.getElementById('app'));
|
||||
|
||||
try {
|
||||
root.render(
|
||||
React.createElement(ErrorBoundary, null,
|
||||
React.createElement(Excalidraw, {
|
||||
theme: 'dark',
|
||||
excalidrawRef: (api) => {
|
||||
add('✓ excalidrawRef CALLBACK FIRED!', 'pass');
|
||||
},
|
||||
onChange: () => {
|
||||
add(' onChange called', 'info');
|
||||
},
|
||||
onPointerUpdate: () => {
|
||||
// noisy, skip
|
||||
}
|
||||
})
|
||||
)
|
||||
);
|
||||
add('render() executed - waiting...', 'info');
|
||||
} catch(e) {
|
||||
add(`✗ RENDER CRASH: ${e.message}`, 'fail');
|
||||
add(` ${e.stack}`, 'info');
|
||||
}
|
||||
} catch(e) {
|
||||
add(`✗ IMPORT ERROR: ${e.message}`, 'fail');
|
||||
add(` ${e.stack}`, 'info');
|
||||
}
|
||||
|
||||
add('\nOpen browser console (F12) for more errors.', 'info');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user