atom-community / markdown-preview-plus

Markdown Preview + Community Features
https://atom.io/packages/markdown-preview-plus
Other
370 stars 85 forks source link

Error: The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called #472

Closed Meduris closed 4 years ago

Meduris commented 4 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.41.0 x64 Electron: 4.2.7 OS: Ubuntu 18.04.3 Thrown From: markdown-preview-plus package 3.11.0

Stack Trace

Error: The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called.

At The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called.

Error: The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called.
    at getGuestInstanceId (/usr/share/atom/resources/electron.asar/renderer/web-view/web-view.js:241:13)
    at HTMLElement.send (/usr/share/atom/resources/electron.asar/renderer/web-view/web-view.js:272:77)
    at WebviewHandler.error (/packages/markdown-preview-plus/lib/markdown-preview-view/webview-handler.js:164:23)
    at MarkdownPreviewViewEditor.showError (/packages/markdown-preview-plus/lib/markdown-preview-view/markdown-preview-view.js:232:22)
    at MarkdownPreviewViewEditor.renderMarkdownText (/packages/markdown-preview-plus/lib/markdown-preview-view/markdown-preview-view.js:220:18)

Commands

Non-Core Packages

atom-math 0.0.9 
greek-snippets 0.1.0 
markdown-preview-plus 3.11.0 
mr-markdown-pdf 1.6.0 
special-symbols 0.1.0 
teletype 0.13.4 

I know this has already been reportet in #456 and #458 but since atom updated Electron to 4.2.7 with the 1.41.0 release, this error now shows up with the official atom builds too.

(I am using the official apt repository linked here https://flight-manual.atom.io/getting-started/sections/installing-atom/ for installing atom)

lierdakil commented 4 years ago

Hi. Thanks for the heads-up. Unfortunately, I can't reproduce this.

I've published v3.11.1 with some general tweaks that might help, but since I can't reproduce the issue, I can't test if my tweaks worked or not.

In case this still reproduces on v3.11.1, could you perhaps write a short guide on reproducing the issue? Thanks in advance.

Meduris commented 4 years ago

Hello, I just tried again with v3.11.1 and get a slightly different error:

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.41.0 x64 Electron: 4.2.7 OS: Ubuntu 18.04.3 Thrown From: markdown-preview-plus package 3.11.1

Stack Trace

Error reported when Markdown Preview Plus view is loading

At The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called.

Error: The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called.
    at getGuestInstanceId (/usr/share/atom/resources/electron.asar/renderer/web-view/web-view.js:241:13)
    at HTMLElement.send (/usr/share/atom/resources/electron.asar/renderer/web-view/web-view.js:272:77)
    at Promise (/packages/markdown-preview-plus/lib/markdown-preview-view/webview-handler.js:186:27)
    at new Promise (<anonymous>)
    at WebviewHandler.runRequest (/packages/markdown-preview-plus/lib/markdown-preview-view/webview-handler.js:177:16)
    at WebviewHandler.update (/packages/markdown-preview-plus/lib/markdown-preview-view/webview-handler.js:101:21)
    at MarkdownPreviewViewEditor.renderMarkdownText (/packages/markdown-preview-plus/lib/markdown-preview-view/markdown-preview-view.js:226:32)

Commands

Non-Core Packages

atom-math 0.0.9 
greek-snippets 0.1.0 
markdown-preview-plus 3.11.1 
mr-markdown-pdf 1.6.0 
special-symbols 0.1.0 
teletype 0.13.4 

I did some testing right now and I can reproduce the error with a 100% rate with the following steps:

  1. open a preview for at least two files
  2. close atom
  3. open atom again with this, I get the error every single time. But it won't happen with just one preview tab being open.

Also it does not matter if only one or both of the preview tabs are visible at the same time.

These are the files I used for testing: test1.txt test2.txt

magerton commented 4 years ago

Something similar is happening for me. I had 3 Markdown Preview files open and got an error related to WebView. I closed 2 of 3 and no longer get an error. However, when I move the preview to a separate tab, it is blank.

lierdakil commented 4 years ago

Thanks @Meduris, I was able to reproduce using your guide.

I think this should be fixed in v3.11.2. Please let me know if not.

@magerton, without a full error report, this isn't very useful, sorry to say. The issue reported here is hopefully fixed in v3.11.2. The blank preview happens from time to time when an editor is closed, but its preview is not -- I've tried fixing that in v3.11.2; let me know if you can still reproduce it -- please do open a new issue for that though.

Meduris commented 4 years ago

I just tried v3.11.3 and no longer get any error messages when starting atom with open preview tabs.

Thank you for your work @lierdakil