accordproject / web-components

React Components for Accord Project
Apache License 2.0
117 stars 94 forks source link

contract-editor error onChange: Cannot read property 'focus' of null #335

Closed rsilva-uw closed 3 years ago

rsilva-uw commented 3 years ago

I'm having the same issue over and over again. When I initialize the contract editor, same code as it is in the storybook i keep getting this crash error:

image

I went further ahead and saw the same error on the storybook, however, in this environment the error is suppressed, which in developmnet it is not, and its pretty hard to develop with this always popping up:

image

dselman commented 3 years ago

Interesting, thanks. The Refused to set unsafe header message appears to be a Chrome issue (could be harmless?). https://stackoverflow.com/questions/54828208/how-to-resolve-refused-to-set-unsafe-header-user-agent-in-javascript

It might be getting triggered by this code: https://github.com/accordproject/cicero/blob/fe8e25264763689dd57cf2ff0933f5c5a6d82059/packages/cicero-core/src/templatelibrary.js#L141

Can you help me reproduce the other error you are seeing?

rsilva-uw commented 3 years ago

Uhh, I don't think that error is a problem per se. My main issue is that "Cannot read property "focus" of null" which is both happening here: https://ap-web-components.netlify.app/?path=/story/contract-editor--contract-editor and when I'm developing. As I said, in the storybook the error is supressed, but in a development environment the issue keeps popping up and crashing the app.

dselman commented 3 years ago

Uhh, I don't think that error is a problem per se. My main issue is that "Cannot read property "focus" of null" which is both happening here: https://ap-web-components.netlify.app/?path=/story/contract-editor--contract-editor and when I'm developing. As I said, in the storybook the error is supressed, but in a development environment the issue keeps popping up and crashing the app.

Thanks, that helps. I see the error occur once in the storybook (on load?) and then it does not reoccur. The stack is:

[Error] Unhandled Promise Rejection: TypeError: null is not an object (evaluating '_.selection.focus')
    onChange (main.4b782334bb7dec72a581.bundle.js:1:231564)
    (anonymous function) (vendors~main.4b782334bb7dec72a581.bundle.js:2:184859)
    (anonymous function) (vendors~main.4b782334bb7dec72a581.bundle.js:2:188069)
    Mj (vendors~main.4b782334bb7dec72a581.bundle.js:2:4271927)
    (anonymous function) (vendors~main.4b782334bb7dec72a581.bundle.js:2:187984)
    (anonymous function) (main.4b782334bb7dec72a581.bundle.js:1:100600)
    (anonymous function) (vendors~main.4b782334bb7dec72a581.bundle.js:2:113902)
    promiseReactionJob

Which implies that the onChange handler

dselman commented 3 years ago

Fix has been released https://github.com/accordproject/web-components/releases/tag/v0.98.0

rsilva-uw commented 3 years ago

Nice. In the meantime I forked the repo to have more freedom in changes to my needs.