Skip to content

Commit

Permalink
Suppress error from monaco-editor (#29684)
Browse files Browse the repository at this point in the history
Fixes: go-gitea/gitea#29414

I see no way for us to catch this error, so downgrade it until
microsoft/monaco-editor#4325 is fixed, which
will likely take a few weeks to propagate up from vscode.

The entries in `updates.config.js` will make
[`updates`](https://github.com/silverwind/updates) not upgrade these
anymore and I think it's good documentation as well to have the reasons
why we don't upgrade these dependencies.

(cherry picked from commit 9bf693d98ddf8efa058a5fbbb6a3da5e0c12ab27)
  • Loading branch information
silverwind authored and earl-warren committed Mar 11, 2024
1 parent 1b48084 commit 27beed7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions web_src/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@
// This file must be imported before any lazy-loading is being attempted.
__webpack_public_path__ = `${window.config?.assetUrlPrefix ?? '/assets'}/`;

const filteredErrors = new Set([
'getModifierState is not a function', // https://github.com/microsoft/monaco-editor/issues/4325
]);

export function showGlobalErrorMessage(msg) {
const pageContent = document.querySelector('.page-content');
if (!pageContent) return;

for (const filteredError of filteredErrors) {
if (msg.includes(filteredError)) return;
}

// compact the message to a data attribute to avoid too many duplicated messages
const msgCompact = msg.replace(/\W/g, '').trim();
let msgDiv = pageContent.querySelector(`.js-global-error[data-global-error-msg-compact="${msgCompact}"]`);
Expand Down

0 comments on commit 27beed7

Please sign in to comment.