react-md-editor icon indicating copy to clipboard operation
react-md-editor copied to clipboard

Editor forces window reload

Open rafaelguedes opened this issue 4 years ago • 7 comments

The first time that the editor is loaded it's forcing a window reload. This should be avoided since the reload will, as expected, creating various issues such as losing states.

Here is a sandbox displaying this issue. https://codesandbox.io/s/create-next-app-example-forked-xm1jn

It's using two markdown editors for comparison purposes. If you click in "Other editor" first, the app is not reloading and is working as expected; after this, if you click on "Uiwjs" the app will be reloaded and the console will log "APP WILL RELOAD" (triggered by beforeunload event).

  • This only happens the first time you open the editor after booting the app (I believe that in the following the page is prefetched);
  • I'm not sure if this happens in production, but at least in development mode it's an issue;

Create-next-app-example-forked-CodeSandbox

rafaelguedes avatar Jul 23 '21 11:07 rafaelguedes

I don't know how to deal with this problem. I don't know how it was caused.

@rafaelguedes

jaywcjlove avatar Jul 23 '21 15:07 jaywcjlove

Can you, please, try to find what might be causing it? I believe it should be fixed.

rafaelguedes avatar Jul 23 '21 16:07 rafaelguedes

The problem did not reproduce on macOS. Maybe I need to find a windows test.

jaywcjlove avatar Jul 23 '21 17:07 jaywcjlove

That gif, that shows the issue, was taken on macOS. The issue do reproduce on macOS.

rafaelguedes avatar Jul 23 '21 17:07 rafaelguedes

@jaywcjlove, do you plan to try to find the cause of this issue?

rafaelguedes avatar Jul 26 '21 13:07 rafaelguedes

@rafaelguedes Well, yes, I will try to reproduce it when I have time.

jaywcjlove avatar Jul 26 '21 14:07 jaywcjlove

This may be caused by dependency on react-markdown.

There is no problem in the production environment.

It cannot be resolved at this time.

@rafaelguedes

jaywcjlove avatar Jul 26 '21 16:07 jaywcjlove