How do I improve the editor performance

I have a search page in my website with about 25 repeaters, each of them in its own strip. These repeaters get data filtered from about 30 or so datasets. Until a few months ago, though the editor performance was slow, it was bearable. But now (after Wix made the change to how repeaters are displayed during the editing process with at least 9 items showing) the editing performance of the page is horrible. I make one small change (just move a box a few pixels) and I have to wait more than a minute before I could do another change. This is horrible. I can’t get any work done on that page.

You might say that 25 repeaters on a page is a lot of repeaters. But while I was designing the page, it was manageable. Only after the latest changes to the editor has it become a nightmare scenario.

But on the published site, the performance of the page is not at all bad and it works like a charm. I wish the editor was more responsive. It is a true nightmare for me since I can’t get anything done.

The site is svwoodturners.com and there is a giant magnifying glass on the menu bar that brings up that page. Try typing “mike”. The performance is good. But I can’t go back to making changes to that page due to the editor performance.

One thing I spotted is that on the page Search, the call to logKey() needs to handle the returned Promise from the backend web module. Something like this:

await logKey(k, ip);

I suspect that the issues you are encountering are due to the complexity of your page and its code. When I run the Live site (and search for “mike” as you suggest), I get a number of the following errors in the browser’s console:


From this, it appears that you have problems with the dataset filters.

When I run in Preview, sometimes the browser (Chrome) just crashes, other times I get timeout errors. I’ve had Chrome crash over a dozen times so far.

Understand that we are unable to debug or rewrite complex code and page configurations. If you feel that there is a bug in Velo, then please try to create a test page with the minimum scenario in which the problem appears to help us investigate the issue properly. You should handle each Repeater and dataset filter separately to ensure that the each works as expected.

Well, I commented out the whole code to the search page code which is only 146 lines. I know the editor performance is not associated with the logic in the search code. The search page layout and the logic behind the code is not complex and is so simple. I don’t mind sharing it here.

  1. Have a repeater for each database (about 25 or so in my case).
  2. Put each repeater in its own strip. Each strip has 1 text box which is a link and 1 repeater.
  3. When the user enters a query in the search box do the following
    a) collapse all strips
    b) cycle through each repeater and apply the filter which essentially checks 2 or 3 columns of the corresponding database using .contains(query). If the filter returns more than 0 items, expand that particular strip.

The reason to do it this way is to make sure that the search results will look exactly like the data you see on the other pages of the website.

Even the data displayed in each container of a repeater is straight forward. Most of them have about 2 images and 3 small lines of text (name, date, title).

I am trying to guess what is happening behind the scenes in the editor and why the performance degraded over night after Wix made changes to how repeaters are displayed in the editor.

I am suspecting that some editor code from editor X is shared back with the old editor. Editor X has to calculate layout based on a fluid model where as the old editor used to have a fixed or no-flow layout. When you try to move or expand a text box in the editor, it ends up recalculating the positions of everything that follows.

Another reason why I think the performance has deteriorated for the editor (and not for the final display of the webpage) is how repeaters are handled now in the editor. Now every repeater shows the first 12 items in the editor. In the past it used to show only one container and that also without the actual data from the database. This is a big problem. I have no idea why it has to display 12 items for each repeater during the editing process. Though the feedback loop will look cool for a small testcase, in the real world scenario where the actual data is getting filtered by the velo code, there is no need for the display of 12 containers for every repeater.

Just a simple calculation of what the wix edditor layout code had to go through in the past vs. now.

In the past:
Each repeater has 1 container with 3 images, 4 text boxes = approximately 10 rectangles.
Each strip (1 rectangle) with one text box (1 rectangle) and 1 repeater (10 rectangles) = 12 rectangles.
About 25 strips with 12 rectangles each = 300 rectangles.

Now with the new repeater layout:
Each repeater has 12 containers with 3 images, 4 text boxes each = approximately 120 rectangles.
Each strip (1 rectangle) with one text box (1 rectangle) and 1 repeater (100 rectangles) = 122 rectangles.
About 25 strips with 122 rectangles each = more than 3000 rectangles.

So now when you make a change to one small text box anywhere on the page, the editor goes through recalculating about 3000 rectangles instead of the 300 it used to do in the past. And the browser is not able to handle all the data for these 3000+ rectangles being moved especially when it has to communicate back and forth for every pixel moved. That is the reason why chrome crashes. I use Firefox. It doesn’t crash, but it basically comes to a crawl. To complicate this even further, the editor is actually accessing the 25 or so database contents to display all that 12 containers for each repeater. This is way overkill. And with async/await javascript code happening in the background in the layout manager code to do this, it can lead to async/await hell.

I know most of the programmers at Wix are much smarter and knowledgeable than myself when it comes to javascript coding. But all it takes is one newbie programmer who falls into the async/await trap and who puts async/await in a loop that calculates the layout for the editors layout manager. Maybe finding those bottlenecks is all that takes to fix the performance problem.

An example of this scenario is shown in the following article.

https://www.freecodecamp.org/news/avoiding-the-async-await-hell-c77a0fb71c4c/

A possible workaround or solution:

Give the website developer the option to decide whether they want 12 or 1 container for repeaters displayed during the editing process. Why hard code the number 12? Let the website developer set it in settings. If it is 1 container then don’t even bother looking at the actual contents of the database. Do it as it was done before.

Another workaround or solution:

Treat each strip like a black box during the editing process. Do not do any layout calculation for a strip if it is not the active one during the editing process. That way only one repeater will be active during the editing process at any given time.

What is the source of the dataset filter errors that I posted? Any idea? I tried the Search page again and I still get those errors.

Errors such as these will have a significant negative impact on performance, creating timeouts, bottlenecks, and often causing system failures.

I would like to refer your problem to QA for evaluation. However the first thing that they will request is for the errors to be fixed, as it is virtually impossible to track down bugs when other issues are obfuscating what’s really going on.

I will track these errors. Most of these errors during run time are a little too cryptic for me to say why they are happening. Especially the one about currentIndexChanged. I know it happens when the number of items after the filter goes to zero. Could it be that the dataset has a filter and I also end up filtering in the velo code? Not sure. In fact if I find a solution to this error message it will fix another problem I had asked the forum earlier in the month.

https://www.wix.com/velo/forum/coding-with-velo/dataset-refresh-gives-an-error-but-no-way-to-catch-it?appSectionParams=%7B%22origin%22%3A%22member_posts_page%22%7D

I will burn my midnight oil hunting it down. But one thing I found out is that even when I comment out the whole code on my search page the editor performance problem exists.

@siliconvalleywoodtur I would like to send this on to QA for evaluation, but it would be best if there weren’t any errors.

Do you still get the dataset filter errors when you “comment out the whole code”?

@yisrael-wix When I comment out the velo code in the search page, search doesn’t work. What I meant was even if there is no velo code associated with that page, the performance issue associated with editing the layout of that page is still there. QA can make a copy of the whole website to a new name and then try to move some text boxes in a few of the repeaters in the copied site on that page and see what happens. As I said before, I don’t see much of a performance problem when somebody visits the site (even though the filter errors are there). It is when I want to modify the search page layout that I have trouble.

With regard to the filter, I suspect my filter construct may not be ideal. I have code that looks like this:

let newFilter = wixData . filter ();
newFilter = newFilter . contains (f[ 0 ], k );
for ( let i = 1 ; i < f . length ; i ++) {
newFilter = newFilter . or ( wixData . filter (). contains (f[i], k ));
}
$w ( ds ). setFilter ( newFilter )
. then (() => {
if ( $w ( ds ). getTotalCount () > 0 )
FSAaccept (s);
else
FSAreject (s);
})
. catch ( err => console . log ( err ));

In the above code in the for loop, f[] is a set of columns in the database, k is the query string. What I mean to do there is to check whether the query string k is in any of those given columns. Maybe there is a better construct for that chaining of .contains() using .or() that I am not aware of. Probably the dataset may not be ready to do the getTotalCount() right after setting the filter. Am not sure what is happening underneath.

Even with the errors in the console, the search functionality that I have does give the right results as expected.

I am in the process of recreating the “could not resolve dynamic filter” error in a stand alone one page website. I will let you know once I succeed with that one.

@yisrael-wix I isolated 3 lines (lines 24, 25 & 30) in the search page and commented them out. That stopped the dataset filter errors from happening for the search term ‘mike’. But if I enter the search term ‘cindy’, I get a bunch of those dataset filter errors from the other datasets. It is absolutely weird. The logic doesn’t change based on what search term is used. The same search key is applied to all the datasets. So it doesn’t look like something I could fix by changing the logic in my code. For now I will keep those 3 lines commented out so that Wix QA can test it out with the search term ‘mike’.

@siliconvalleywoodtur I’ll refer this to QA and hope that the code complexity doesn’t create a blocker for them to evaluate.

@yisrael-wix Thank you.

It’s been over a month. Has the QA team looked at this problem and what is the diagnosis?