react-ace icon indicating copy to clipboard operation
react-ace copied to clipboard

Browser is stuck and Memory keeps raising after typing in editor

Open SecMao opened this issue 8 years ago • 6 comments

Problem

set maxLines as 1 or 2, with onLoad set wrap mode as true at the same time, click before the last curly brace and type Enter button to make the editor formatting automatically, you will find the browser stuck and the memory raising.

Sample code to reproduce your issue

<AceEditor
      mode="json" maxLines={2} value={"{\"a\":\"b\"}"}
      onLoad={editor => editor.getSession().setUseWrapMode(true)}
/>

or visit the simple project react-ace-editor-issuse

References

Initial memory and CPU tim 20170706095723 10 sec after type Enter button tim 20170706095813

Progress on: # Win 10 / Chrome 58&IE 11/ React 15.6.1

SecMao avatar Jul 06 '17 02:07 SecMao

We considered moving away from https://github.com/JedWatson/react-codemirror because at least at the moment it is not maintained well (aka the maintainer does not merge or reacts to PRs) but this here is a blocker that stops that.

inoas avatar Jul 12 '17 13:07 inoas

@SecMao I'm unable to reproduce on my mac. I'll need to find a Windows laptop to reproduce.

@inoas were you able to reproduce this issue? I see a few comments mentioning that you were looking to switch from codemirror but it's unclear if you saw these issues locally.

securingsincity avatar Jul 18 '17 11:07 securingsincity

We haven't made the move just yet and will try to reproduce this if we do and report back in either case (no leak or "looks like" leak)

inoas avatar Jul 19 '17 14:07 inoas

i am using React v16.4, react-ace v6.1.2

  1. setup with create-react-app
  2. and test with code below, setting AceEditor with maxLines and wrapEnabled
class App extends React.Component {
  render() {

    const props = {
      mode: 'javascript',
      theme: 'monokai',
      value: 'const test = \'hello loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong text\'',
      maxLines: 1,
      wrapEnabled: true,
    };

    return (
      <div>
        <AceEditor {...props} />
      </div>
    );
  }
}

and it will cause cpu and memory raising image

hirohe avatar Jun 28 '18 05:06 hirohe

@securingsincity This issue is also reproducible in Ubuntu 16.

malavshah9 avatar Apr 19 '21 04:04 malavshah9

@malavshah9 are you seeing this with the current version of react-ace? this used to happen with the older version, which was using the old version of ace, which had this bug, but it is fixed on ace version 1.4.12

nightwing avatar Apr 19 '21 21:04 nightwing