Wix rendering engine issues in "Live" (vs. Preview)

When writing ‘dynamic’ code, rendering towards Chrome/Safari is often not in sync with Preview mode. Quite often what I coded works fine in Preview, but does not in Chrome/Safari, even when implemented multiple ways… As you can imagine, this is quite frustrating.

Minimum Working Example:

Use case

  1. Add item 1
  2. Add item 2
  3. Add item 3
  4. Remove item 3
  5. Add item → issue

@yisrael-wix finally found the time to work out a MWE for the issue I raised a while back: https://www.wix.com/velo/forum/coding-with-velo/issue-wix-not-properly-rendering-computed-values

Umm, 370 lines of code isn’t exactly what I would call minimum . But…

In the page onReady(), you have a Repeater forEachItem() , but the Repeater won’t have anything in it yet since the page is just now being loaded. So, forEachItem() won’t do anything. What is it that are you trying to do?

It is minimum working .

That part of the code just checks if there’s already anything added to the repeater. If true, the repeater should expand. When initially visiting the page, this will indeed be skipped as there are no elements added to the repeater. However, when a user adds items, they will be stored in a session. On refresh or return to that page, that session data will be used to populate the repeater. I removed that functionality for this MWE.

Regardless, just play with the implementation I would say - coding-wise it’s all in order. So try it out in ‘Preview’ and then try it out in ‘Live’. As you will see, in ‘Preview’ it works fine, while in ‘Live’ it does not.

I’ve referred this to QA for evaluation.

@yisrael-wix any news on the QA evaluation?

Hey @vervoortyves , finally got some clarity on this. The issue is that the behavior of the Repeater that you are expecting is not a product requirement or specification. So, there is nothing to fix. Re-adding an item with the same item _id is not expected to be a “fresh” item and will not trigger the onItemReady() event handler. To update items with existing IDs, you can use the forEachItem() or forItems() functions.

The other way you can do this is that after adding an item, you can do the following which will cause a full refresh of the Repeater.

let items = $("#Repeater").data;
$("#Repeater").data = [];
$("#Repeater").data = items;

OK, I’ll look into it, but why does it work in Preview then, but not in Live?

@vervoortyves Yeah - I know that’s strange. The reason is, is that Preview runs in a slightly different run/view environment. The devs are working on having Preview run under the same viewer as Preview so that results will be uniform. Not sure when that will happen, but I know that work is progressing.

@yisrael-wix have Preview run under the same viewer as Life or the other way around?

@vervoortyves Preview to run under the same view as Live. The Live viewer is newer and much more advanced. It is also much more performant.

@vervoortyves BTW - I’m not happy at all with the answers I’m getting regarding this issue. I’m turning over tables and pushing to have this done right. Stay tuned.