From b18720d72a6a9d98c7eedf812a885a836b7b9140 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Dec 2025 02:47:59 +0000 Subject: [PATCH 1/3] Initial plan From 2c2bdce10568a81d7cb8514f3b1d6580bb7f94c7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Dec 2025 02:54:50 +0000 Subject: [PATCH 2/3] Add global error handler for CodeMirror DOM position errors Co-authored-by: curran <68416+curran@users.noreply.github.com> --- src/client/main.jsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/client/main.jsx b/src/client/main.jsx index 80eb1f2d..28383c65 100644 --- a/src/client/main.jsx +++ b/src/client/main.jsx @@ -3,6 +3,29 @@ import * as ReactDOM from 'react-dom/client'; import App from './App'; import { BrowserRouter } from 'react-router-dom'; +// Global error handler to catch CodeMirror DOM position errors +// These can occur when CodeMirror instances are created but not yet +// attached to the DOM, or when presence indicators try to render +// on offscreen editor instances. +window.addEventListener('error', (event) => { + // Check if this is the specific CodeMirror posFromDOM/posAtDOM error + if ( + event.error instanceof RangeError && + event.error.message.includes( + 'Trying to find position for a DOM position outside of the document', + ) + ) { + // Log the error for debugging purposes + console.log( + 'Suppressed CodeMirror DOM position error:', + event.error, + ); + // Prevent the error from propagating + event.preventDefault(); + return true; + } +}); + ReactDOM.createRoot(document.getElementById('root')).render( From 4838d3025b30cc92e064341ea98ead10142c7f42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Dec 2025 02:57:30 +0000 Subject: [PATCH 3/3] Remove unnecessary event.preventDefault() from error handler Co-authored-by: curran <68416+curran@users.noreply.github.com> --- src/client/main.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/client/main.jsx b/src/client/main.jsx index 28383c65..434e42ee 100644 --- a/src/client/main.jsx +++ b/src/client/main.jsx @@ -20,8 +20,7 @@ window.addEventListener('error', (event) => { 'Suppressed CodeMirror DOM position error:', event.error, ); - // Prevent the error from propagating - event.preventDefault(); + // Prevent the error from being logged to console by returning true return true; } });