maxi-blocks icon indicating copy to clipboard operation
maxi-blocks copied to clipboard

Long freezes

Open Olekrut opened this issue 2 years ago • 2 comments

Description

noticed very long freezes on few page with big amount of block after refresh page everything is ok, > working 20-30min > freezes are backing

console is empty noticed on https://3devdemo.maxiblocks.com/story-mix-light-sml-pro-part-17/

Step-by-step reproduction instructions

  1. after refresh page everything is ok,
  2. working 20-30min
  3. freezes are backing

Screenshots, screen recording, code snippet

No response

URL and/or Code editor

No response

How to fix it

No response

Other information

No response

Olekrut avatar Jan 19 '24 15:01 Olekrut

🤖

Hey @Olekrut! Great to cross paths with you again here on GitHub. Hope you're doing well amidst the code and commits! 🚀

The long freezes you're experiencing on pages with a large number of blocks in Maxi Blocks v1.6.0 could be due to the high computational load of a function called getMaxiBlockAttributes. This function is responsible for generating the attributes for each block on the page.

In the context of your issue, this function is performing a significant number of operations for each block, including looping through each scroll type and generating a string of settings for each one. This could potentially be a heavy operation, especially on pages with a large number of blocks.

The function also uses the isEmpty function from lodash multiple times, which can be computationally expensive, especially when used in a loop or for large objects.

To confirm this, you would need to profile the performance of the page and specifically this function to see if it is indeed the cause of the freezes. If it is, optimizing this function could potentially solve the issue. This could involve reducing the number of operations performed in the function, optimizing the use of lodash functions, or potentially offloading some of the work to a Web Worker to avoid blocking the main thread.

You can find more details about this function in the getMaxiBlockAttributes.js file in the repository.

Unfortunately, I wasn't able to find the average number of blocks on the pages where the freezes are occurring. Could you provide more information about the number of blocks on these pages? This could help in further diagnosing the issue.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Jan 19 '24 15:01 dosubot[bot]

even less, not 20-30 min, every 10min, guess related to amount of blocks on page) Very annoying

Olekrut avatar Feb 13 '24 14:02 Olekrut

[Crashes] In full site editing when I used the repeater and CL - I recreated the steps in normal editing and it was fine. slow but not crash

and the other time was changing a page template

elzadj avatar Nov 06 '24 15:11 elzadj

https://maxiblocks.com/demo/wordpress-patterns/wordpress-blog/pbgl-pro-07/

dashaversha avatar Dec 23 '24 14:12 dashaversha

blog-code.txt

elzadj avatar Dec 23 '24 14:12 elzadj