-
-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught promise when using useMonaco() #440
Comments
Do you use React 18 with strict mode? |
Yes, 18.2. It's a Next.js (13.0.7) app. Not sure about strict mode. |
could you please check this? |
I get the same error in the console. I am using React 18 in strict mode but not Next.js |
Same error but probably a different case with React 18 and no Next.js.
If I don't load it lazy it would work but that's not an option in my project. Works:
Doesn't work:
|
We are encountering this issue as well: Aiven-Open/klaw#1464 I have been able to ascertain that this |
I also ascertained that the |
The same error with React 18 in strict mode, not Next.js |
I get the same error when updating the JSON schema with useEffect().
import React, { useEffect } from 'react';
import Editor, { useMonaco } from '@monaco-editor/react';
interface IConfigEditor {
value: string;
path?: string;
schemaUri?: string;
}
export const ConfigEditor: React.FC<IConfigEditor> = props => {
const monaco = useMonaco();
useEffect(() => {
if (monaco && props.path && props.schemaUri) {
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
validate: true,
enableSchemaRequest: true,
schemas: [
{
uri: props.schemaUri,
fileMatch: [props.path],
},
],
});
}
}, [monaco, props.path, props.schemaUri]);
return (
<Editor
path={props.path}
language="json"
value={props.value}
/>
)
}; Edit: |
When I add these lines:
I get the following error in my browser console:
The text was updated successfully, but these errors were encountered: