uiwjs / react-markdown-editor

A markdown editor with preview, implemented with React.js and TypeScript.
https://uiwjs.github.io/react-markdown-editor
MIT License
327 stars 32 forks source link

ResizeObserver loop completed with undelivered notifications #202

Closed mauro-rogledi closed 1 year ago

mauro-rogledi commented 1 year ago

This is my sample code.

App,tsx

import MarkdownEditor from "@uiw/react-markdown-editor";
import { useState } from "react";

function App() {
  const [value, setValue] = useState("***hello***");
  return (
    <div className='App'>
      <MarkdownEditor
        value={value}
        onChange={(value, viewUpdate) => {
          setValue(value);
        }}
        renderPreview={() => <div />}
      />
    </div>
  );
}

export default App;

package.json

{
  "name": "resizeobserver",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.17.0",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@types/jest": "^27.5.2",
    "@types/node": "^16.18.39",
    "@types/react": "^18.2.16",
    "@types/react-dom": "^18.2.7",
    "@uiw/react-markdown-editor": "^5.11.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "typescript": "^4.9.5",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

image

When I run and double click on the top right tile, the program crashes with this error

Uncaught runtime errors:
×
ERROR
ResizeObserver loop limit exceeded
    at handleError (http://localhost:3000/static/js/bundle.js:52748:58)
    at http://localhost:3000/static/js/bundle.js:52767:7
jaywcjlove commented 1 year ago

@mauro-rogledi If you provide a reproducible example using codesandbox.io, I can help you troubleshoot.

mauro-rogledi commented 1 year ago

For some strange reason inside codesandbox.io the code works.

Try on your local machine with

npx create-react-app resizeobserver --template typescript
cd resizeobserver
npm i @uiw/react-markdown-editor

then replace App.tsx with the code in the above example

Double click the fullscreen icon and you get the crash.

jaywcjlove commented 1 year ago

@mauro-rogledi Upgrade v5.11.2

mauro-rogledi commented 1 year ago

Perfect. Now works. Thank you