Skip to content
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 Error: TextModel got disposed before DiffEditorWidget model got reset #647

Open
armisael opened this issue Sep 25, 2024 · 6 comments

Comments

@armisael
Copy link

When using DiffEditor with Monaco 0.51 and the component is unmounted, the following error is thrown:

Error: TextModel got disposed before DiffEditorWidget model got reset
    at u.value (diffEditorWidget.ts:327:24)
    at d._deliver (event.ts:1213:13)
    at d._deliverQueue (event.ts:1224:9)
    at d.fire (event.ts:1248:9)
    at q.dispose (textModel.ts:356:23)
...

The error does not appear with Monaco 0.50.

To Reproduce

I prepared a minimal code snippet to reproduce the issue: https://github.com/armisael/test-react-monaco-diff

Simply:

  1. npm run dev
  2. open your browser on http://localhost:3000
  3. open the inspector
  4. click on "Show editor"
  5. click on "Hide editor"
  6. see the error in console

Desktop (please complete the following information):

  • OS: OSX
  • Browser: Arc (chromium-based)
  • Version: @monaco-editor/react 4.6.0
@Eyal-Be
Copy link

Eyal-Be commented Sep 25, 2024

@armisael Do you know if this error has any real impact, or is it safe to ignore?

@armisael
Copy link
Author

In our case we didn't notice any real impact, so our solution was indeed to ignore it, but I can't assume this is true for all cases.

Also, people over microsoft/vscode#218001 had what looks like the same issue, and fixed it a couple of months ago.

@suren-atoyan
Copy link
Owner

@armisael @Eyal-Be could you please try to load the latest monaco-editor version via loader and see if the fix @armisael mentioned here helps? You can do something like this

@armisael
Copy link
Author

Hi @suren-atoyan , that's exactly what I'm doing in the test project, have a look at:

https://github.com/armisael/test-react-monaco-diff/blob/main/src/components/MonacoDiffEditor.tsx

The error appears when using monaco-editor@0.51.0 and monaco-editor@0.52.0, but not with monaco-editor@0.50.0.

I'm not sure how to interpret the issue on microsoft/vscode#218001 I'm afraid I can't help much

@tsx-ell
Copy link

tsx-ell commented Dec 11, 2024

i'm experiencing the same error and in my case it is a problem indeed:
i have a nextjs react app, and a page with a several Editors and DiffEditors, which can be switched by sidebar tabs,
in case where i have 2+ DiffEditors and i switch between them a couple times – i get the mentioned error and the result looks like monaco is showing me correct text in the DiffEditor but is using a model from the previous tab' DiffEditor to highlight the diffs:
image

@SundaramMaheshkumar
Copy link

Any update to this as the issue is still there when the DiffEditor is unmounted !?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants