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

[Bug] Unmounting component in react throws error #4779

Open
2 tasks done
Buster-Darragh-Major opened this issue Dec 10, 2024 · 0 comments
Open
2 tasks done

[Bug] Unmounting component in react throws error #4779

Buster-Darragh-Major opened this issue Dec 10, 2024 · 0 comments
Assignees

Comments

@Buster-Darragh-Major
Copy link

Buster-Darragh-Major commented Dec 10, 2024

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

Reproduction Steps

Using React; mounting the editor component then removing the component from the react DOM throws an error. This did not occur in version 0.50.0 but has started in 0.52.2
Our rendering code looks like:

import type { EditorProps } from "@monaco-editor/react";
import type { FunctionComponent } from "react";
import Editor from "@monaco-editor/react";
import { useUserSettings } from "../hooks/settings/useUserSettings";

const ResizableEditor: FunctionComponent<
  EditorProps & {
    height: string | number;
    border?: string | number;
  }
> = (props) => {
  const { userSettingsState } = useUserSettings();

  return (
    <div style={{ height: props.height, position: "relative", paddingLeft: props.width }}>
        <Editor
          {...props}
          theme={userSettingsState.theme === "dark" ? "vs-dark" : "light"}
          options={{
            ...props.options,
            automaticLayout: true,
          }}
        />
    </div>
  );
};

export { ResizableEditor };

Actual (Problematic) Behavior

Uncaught Error: TextModel got disposed before DiffEditorWidget model got reset Error: TextModel got disposed before DiffEditorWidget model got reset at UniqueContainer.value (http://localhost:3000/@fs/Users/buster.major/Projects/FlywayDesktop/app/node_modules/.vite/deps/chunk-BDJUYZEV.js?v=bde8a730:118452:29) at Emitter._deliver (http://localhost:3000/@fs/Users/buster.major/Projects/FlywayDesktop/app/node_modules/.vite/deps/chunk-BDJUYZEV.js?v=bde8a730:2465:20) at Emitter._deliverQueue (http://localhost:3000/@fs/Users/buster.major/Projects/FlywayDesktop/app/node_modules/.vite/deps/chunk-BDJUYZEV.js?v=bde8a730:2474:16) at Emitter.fire (http://localhost:3000/@fs/Users/buster.major/Projects/FlywayDesktop/app/node_modules/.vite/deps/chunk-BDJUYZEV.js?v=bde8a730:2495:16) at _a7.dispose (http://localhost:3000/@fs/Users/buster.major/Projects/FlywayDesktop/app/node_modules/.vite/deps/chunk-BDJUYZEV.js?v=bde8a730:33272:29) at I (http://localhost:3000/@fs/Users/buster.major/Projects/FlywayDesktop/app/node_modules/.vite/deps/@monaco-editor_react.js?v=bde8a730:605:72) at http://localhost:3000/@fs/Users/buster.major/Projects/FlywayDesktop/app/node_modules/.vite/deps/@monaco-editor_react.js?v=bde8a730:560:189 at safelyCallDestroy (http://localhost:3000/@fs/Users/buster.major/Projects/FlywayDesktop/app/node_modules/.vite/deps/chunk-GSKIDCVT.js?v=bde8a730:16796:13) at commitHookEffectListUnmount (http://localhost:3000/@fs/Users/buster.major/Projects/FlywayDesktop/app/node_modules/.vite/deps/chunk-GSKIDCVT.js?v=bde8a730:16923:19) at commitPassiveUnmountInsideDeletedTreeOnFiber (http://localhost:3000/@fs/Users/buster.major/Projects/FlywayDesktop/app/node_modules/.vite/deps/chunk-GSKIDCVT.js?v=bde8a730:18333:17)

Expected Behavior

Should not error

Additional Context

This did not occur in version 0.50.0 but has started in 0.52.2

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

2 participants