question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: Updating to GrapesJS v19.5 from v18.4 results in Chrome becoming unresponsive

See original GitHub issue

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Chrome 104.0.5112.79

Reproducible demo link

https://jsfiddle.net/gvrnw2c3/4/

Describe the bug

How to reproduce the bug?

I’m currently unable to reproduce the bug using jsfiddle, which leads me to believe it’s a problem with Chrome, but I’ll continue trying to reproduce this.

Within my project as shown in the video:

  1. Click on a ‘conditional-text’ component (custom component type I’ve added)
  2. Click on ‘Open Conditionals’ button then within the dialog that appears on the screen, click ‘Apply’
  3. Hover the cursor over the ‘conditional-text’ component

In JSFiddle (currently doesn’t crash but I will continue to test):

  1. Click on the ‘Hello World’ text component
  2. Click on the ‘Convert to Conditional’ button at the bottom of the page
  3. Click on the newly created ‘conditional-text’ component (with the text “Open conditionals to choose text”)
  4. Click on the ‘Change Conditional’ button at the bottom of the page
  5. Move the cursor over the ‘conditional-text’ component (currently doesn’t crash but I will continue to test)

What is the expected behavior?

The app should continue running as normal (works fine in GrapesJS v18.4)

What is the current behavior?

The whole screen crashes as soon as the cursor is over the ‘conditional-text’ component and after around 5 seconds the following appears:

Screenshot 2022-08-03 at 18 15 14

Here is the screen capture of the issue:

https://user-images.githubusercontent.com/67364267/182598233-29209c1b-b99e-438c-9d9a-3e46dd750a31.mov

After some (unsuccessful) debugging, I also found the following:

The commented out lines in the following methods (which are triggered upon clicking the ‘Apply’ button as seen in the video) seemed to be responsible for the crash. It’s worth mentioning that all of these lines, when not commented out, affect the appearance of the component in the canvas (i.e. they change the visible text), so perhaps it’s something to do with the view of the component being rendered. The other lines below do not result in the crash :

applyIfCondition(conditionCode, conditionObjects) {
      const selectedComponent = this.editor.getSelected()
      if (selectedComponent.isInstanceOf("conditional-text")) {
        console.log(conditionCode, ...conditionObjects)
        selectedComponent.addAttributes({ liquidtag: "if" })
        // selectedComponent.components(conditionCode)
        selectedComponent.set("conditionObjects", conditionObjects)
        selectedComponent.set("isNew", false)
        // selectedComponent.getView().render()
      }
    },
    selectIfCondition(displayText, selectedIndex) {
      const selectedComponent = this.editor.getSelected()
      if (selectedComponent.isInstanceOf("conditional-text")) {
        console.log(displayText, selectedIndex)
        // selectedComponent.set("displayedText", displayText)
        selectedComponent.set("selectedConditionIndex", selectedIndex)
        // selectedComponent.getView().render()
      }
    },

So it’s the following lines that seem to cause the crash, from what I can tell so far - if I uncomment any of these lines from the methods, the text inside the component changes upon clicking apply and the crash happens when hovering over the component :

selectedComponent.components(conditionCode) selectedComponent.getView().render() selectedComponent.set("displayedText", displayText) selectedComponent.getView().render()

N.B. The custom ‘conditional-text’ component in my project is the same as in the jsfiddle - I have tried to reproduce the error by simplifying the rest of the code (I didn’t want to copy over all of the logic from my project), but the code that matters is still being executed.

Please let me know if you require any further information.

Code of Conduct

  • I agree to follow this project’s Code of Conduct

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
benryanwilliamscommented, Aug 15, 2022

Thanks @artf, all working perfectly now upon declaring the editor outside of the Vue instance.

1reaction
artfcommented, Aug 12, 2022

Thanks guys, I was actually able to reproduce it by wrapping the example inside Vue but I’m not sure exactly why is stuck in the loop here. At first look, it seems to be related to Vue’s Proxy observers. By comparing the demo with the previous grapesjs version it looks like not all parts are transformed in Proxies and that prevents it from being stuck. As a quick workaround here would be to put the editor outside of Vue to prevent transforming all objects into proxies.

let editor;
Vue.createApp({
 mounted() {
   editor = grapesjs.init({ ... });
    // ...
  },
 // ..
}).mount('#app')
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a “Page Unresponsive” Error in Google Chrome
Clear Cookies and Browser Cache · 1. Go to Chrome's Settings screen. · 2. Select Privacy and security on the sidebar. · 3....
Read more >
GrapesJS - Bountysource
BUG: Updating to GrapesJS v19.5 from v18.4 results in Chrome becoming unresponsive $ 0. Created 4 months ago in artf/grapesjs with 9 comments....
Read more >
Issues · artf/grapesjs · GitHub
Next generation tool for building templates without coding - Issues ... BUG: Updating to GrapesJS v19.5 from v18.4 results in Chrome becoming unresponsive...
Read more >
How to fix Page Unresponsive error in Google Chrome
There may come a time when Google Chrome might show a “Page Unresponsive ” error. This is usually when a web page takes...
Read more >
How to fix Google Chrome Page Unresponsive ... - YouTube
You can fix Google Chrome "Page unresponsive : The following pages has become unresponsive, Kill pages or wait" problem by three simple ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found