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

onValidate causes docLines[endRow] to be undefined

Open DeedleFake opened this issue 5 years ago • 3 comments

I've got an editor component set up like the following:

const [value, setValue] = useState('')
const [valid, setValid] = useState(true)

return (
  <AceEditor
    mode="javascript"
    theme="vibrant_ink"
    value={value}
    onChange={(val) => {
      setValid(false)
      setValue(val)
    }}
    onValidate={(a) => setValid(a.every(({type}) => type !== 'error'))}
  />
)

Typing the code

const a = 3

console.dir(a)

into the editor produces the following error in the console and causes the validation to break:

Object { message: "TypeError: docLines[endRow] is undefined", data: undefined, file: "blob:http://localhost:3000/55b4663e-18c3-7a41-9756-de9ab36d6084", line: 1, col: 0, stack: "exports.applyDelta@blob:http://localhost:3000/55b4663e-18c3-7a41-9756-de9ab36d6084:1:9527\nthis.applyDelta@blob:http://localhost:3000/55b4663e-18c3-7a41-9756-de9ab36d6084:1:21858\nexports.Mirror/<@blob:http://localhost:3000/55b4663e-18c3-7a41-9756-de9ab36d6084:1:26686\nEventEmitter._signal@blob:http://localhost:3000/55b4663e-18c3-7a41-9756-de9ab36d6084:1:10664\nwindow.onmessage@blob:http://localhost:3000/55b4663e-18c3-7a41-9756-de9ab36d6084:1:3535\n" }
index.js:1437

DeedleFake avatar May 20 '19 22:05 DeedleFake

hi @DeedleFake , I'm facing same issue, do u have any solution?

wanyukang avatar Nov 22 '19 09:11 wanyukang

Sadly, not that I've found. Haven't looked at it in a while, though.

DeedleFake avatar Nov 22 '19 16:11 DeedleFake

@securingsincity Any progress on this issue? I've been experiencing the exact same issue as @DeedleFake, except without any validation.

For me, this is happening with mode="json", but I haven't tried with other modes.

kitallen23 avatar Mar 09 '21 06:03 kitallen23