From dd6c72ea85f188440bfda3b7ac10a0f81dfd5984 Mon Sep 17 00:00:00 2001 From: Tuval Simha Date: Wed, 21 Feb 2024 19:51:01 +0200 Subject: [PATCH] Fix `monaco-editor/react` (#2692) * Fix `monaco-editor/react` * chore(dependencies): updated changesets for modified dependencies --------- Co-authored-by: github-actions[bot] --- pnpm-lock.yaml | 18 +++++++++--------- website/package.json | 2 +- website/src/components/diff/index.tsx | 9 ++++----- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 68d6391607..d870e94d16 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -654,8 +654,8 @@ importers: specifier: ../packages/core/dist version: link:../packages/core/dist '@monaco-editor/react': - specifier: ^4.6.0 - version: 4.6.0(monaco-editor@0.45.0)(react-dom@18.2.0)(react@18.2.0) + specifier: 4.6.0 + version: 4.6.0(monaco-editor@0.46.0)(react-dom@18.2.0)(react@18.2.0) '@theguild/components': specifier: ^6.0.1 version: 6.0.1(@algolia/client-search@4.19.1)(@types/react@18.2.39)(next@13.5.4)(react-dom@18.2.0)(react@18.2.0)(webpack@4.47.0) @@ -2108,24 +2108,24 @@ packages: react: 18.2.0 dev: false - /@monaco-editor/loader@1.4.0(monaco-editor@0.45.0): + /@monaco-editor/loader@1.4.0(monaco-editor@0.46.0): resolution: {integrity: sha512-00ioBig0x642hytVspPl7DbQyaSWRaolYie/UFNjoTdvoKPzo6xrXLhTk9ixgIKcLH5b5vDOjVNiGyY+uDCUlg==} peerDependencies: monaco-editor: '>= 0.21.0 < 1' dependencies: - monaco-editor: 0.45.0 + monaco-editor: 0.46.0 state-local: 1.0.7 dev: false - /@monaco-editor/react@4.6.0(monaco-editor@0.45.0)(react-dom@18.2.0)(react@18.2.0): + /@monaco-editor/react@4.6.0(monaco-editor@0.46.0)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-RFkU9/i7cN2bsq/iTkurMWOEErmYcY6JiQI3Jn+WeR/FGISH8JbHERjpS9oRuSOPvDMJI0Z8nJeKkbOs9sBYQw==} peerDependencies: monaco-editor: '>= 0.25.0 < 1' react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 dependencies: - '@monaco-editor/loader': 1.4.0(monaco-editor@0.45.0) - monaco-editor: 0.45.0 + '@monaco-editor/loader': 1.4.0(monaco-editor@0.46.0) + monaco-editor: 0.46.0 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false @@ -9951,8 +9951,8 @@ packages: ufo: 1.1.2 dev: true - /monaco-editor@0.45.0: - resolution: {integrity: sha512-mjv1G1ZzfEE3k9HZN0dQ2olMdwIfaeAAjFiwNprLfYNRSz7ctv9XuCT7gPtBGrMUeV1/iZzYKj17Khu1hxoHOA==} + /monaco-editor@0.46.0: + resolution: {integrity: sha512-ADwtLIIww+9FKybWscd7OCfm9odsFYHImBRI1v9AviGce55QY8raT+9ihH8jX/E/e6QVSGM+pKj4jSUSRmALNQ==} dev: false /morgan@1.10.0: diff --git a/website/package.json b/website/package.json index b67d8cd1ce..87c14452bb 100644 --- a/website/package.json +++ b/website/package.json @@ -17,7 +17,7 @@ }, "dependencies": { "@graphql-inspector/core": "../packages/core/dist", - "@monaco-editor/react": "^4.6.0", + "@monaco-editor/react": "4.6.0", "@theguild/components": "^6.0.1", "next": "^13.5.4", "react": "^18.2.0", diff --git a/website/src/components/diff/index.tsx b/website/src/components/diff/index.tsx index f5435e91a8..c54676c998 100644 --- a/website/src/components/diff/index.tsx +++ b/website/src/components/diff/index.tsx @@ -2,7 +2,7 @@ import { ReactElement, useCallback, useEffect, useState } from 'react'; import { buildSchema } from 'graphql'; import FlipMove from 'react-flip-move'; import { Change, diff } from '@graphql-inspector/core'; -import { DiffEditor, OnMount } from '@monaco-editor/react'; +import { DiffEditor, DiffOnMount } from '@monaco-editor/react'; import ChangeComponent from './change'; const OLD_SCHEMA = /* GraphQL */ ` @@ -49,8 +49,8 @@ export const Diff = (): ReactElement => { run(); }, [code]); - const onMount: OnMount = useCallback(value => { - const editor = value.getModifiedEditor(); + const onDiffOnMount: DiffOnMount = useCallback(diffEditor => { + const editor = diffEditor.getModifiedEditor(); editor.onKeyUp(() => { setCode(editor.getValue()); }); @@ -65,11 +65,10 @@ export const Diff = (): ReactElement => { theme="vs-dark" original={OLD_SCHEMA} modified={code} - onMount={onMount} + onMount={onDiffOnMount} options={{ codeLens: false, lineNumbers: 'off', - minimap: false, originalEditable: false, }} />