WixTurbo rollout breaking code

Go ahead and post your code @poolshark314 and we might be able to help.

@skmedia In my case the dynamic page is loading – it was the HTML components within the dynamic page that were not sending their onReady message(because it looks like with the Wix Turbo rollout, the platform is no longer reloding the HTML components and hence the dynamic page doesnt receive the onReady message).

However, I found a workaround for this problem – which is posted below and also at its original thread at this link .

Hope this helps.
Also, specifically to your question – I had previously tried a timer, but then realized it was moot because the onMessage would not be triggered (because the HTML component was not being reloaded) – at least in my case since the onReady signal was being sent on load.

@skmedia Thank you I appreciate it. What I would like to do is gather a list of applicable events by executing a query on the events collection, and then pass those events into the 2 dataset filters connected to a results collection to be filtered further. When I execute this, it seems to ignore the events that I pass into it and just use the criteria in the dataset filter. I have console.log(txlist) and the results of txlist are as expected.

I think I should also be able to do this without code if I am not mistaken, by adding the Events collection as its own dataset, and executing the filters there, then modify my boaterdataset and coanglerdataset to say the reference field is the same as the events dataset, but that does not work either.

Ideally I would do this in code because then I can automate what loads depending on the year of the current date, as opposed to manually updating this each time. Thanks in advance


const year = currentItem.season;
const twodigityr = year.toString().substr(-2);
//console.log(year)
//get tx list for the year
wixData.query(‘Events’)
.eq(‘season’, year)
.eq(‘eventtype’, ‘Club Tournament’)
.ascending(‘date’)
.find()
.then((results) => {
let txdata = results.items;
let txlist = txdata.map(item => item.title);
console.log(txlist)
// Set the tables to the current season winners
$w(‘#Boaterdataset’).setFilter(wixData.filter(txlist)
.startsWith(‘title’, twodigityr)
.eq(‘division’,‘Co-Angler’)
.eq(‘place’, 1)
);
$w(‘#Coanglerdataset’).setFilter(wixData.filter(txlist)
.startsWith(‘title’, twodigityr)
.eq(‘division’,‘Co-Angler’)
.eq(‘place’, 1)
);
})
. catch ((err) => {
let errorMsg = err;
})

I know a lot of people are reporting similar symptoms on this simple Wix Code tutorial with the transitioning headers: https://www.youtube.com/watch?v=8iO0G_qWqRY&t=18s

If you read the newest comments or do quick forum search, you’ll see this is affecting virtually everyone who tries it.

The symptoms: It works fine for the first week or two, then after a couple weeks it breaks. From then on, it only works in the Wix Preview, but not on the live sites. It has nothing to do with changes the user makes to the code or site. It is an internal issue.

Please fix this Wix! My website looks terrible without it! =(

#WixTurbo

@poolshark314 Maybe try creating a backend function with the query and pass it on to the page to see if that forces it to function as it should be. I.E. :

//backend module
import wixData from 'wix-data';

export function query(year) {
        wixData.query('Events')
          .eq('season', year)
          .eq('eventtype', 'Club Tournament')
          .ascending('date')
          .find()
          .then((results) => {
                  return results.items
         } )
 }
//page code 
import {query} from 'backend/module'; 

$w.onReady(function() {
  $w('#dataset').onReady(async function() {
     const year = currentItem.season;
     const twodigityr = year.toString().substr(-2);
     let txdata = await query(year);
     let txlist = txdata.map(item => item.title);  
     $w('#Boaterdataset').setFilter(wixData.filter(txlist)
                .startsWith('title', twodigityr)
                .eq('division','Co-Angler')
                .eq('place', 1)
            );
     $w('#Coanglerdataset').setFilter(wixData.filter(txlist)
                .startsWith('title', twodigityr)
                .eq('division','Co-Angler')
                .eq('place', 1)
            );
      } )
} )

Or something to that effect. If it was previously working, it might only take something like this in order to get it working again.

@skmedia below suggestions might help with issues #1 and #5 in post above – I say might because the manifestations of the problems are different across our different sites.

So on #1 – I noticed (on my end) that it visually appears that wixLocation is not working – because the site does not get updated with expected refresh of elements (including HTML components) corresponding to a dynamic page. However, if I check the URL bar – the value reads that of the expected URL.

If this is the case with you then for refreshing the HTML components corresponding to a dynamic page – one would simply follow the solution recipe for #7 posted above.

In other cases, where the elements are not refreshed (and perhaps also for #5)-- my sense is that again this is likely because of failure in onMessage/loading corresponding to those elements on Dynamic Page transition from one id to next. A workaround for this would be to refresh the elements via onCurrentIndexChanged.

   $w("#dynamicDataset").onCurrentIndexChanged((index) => {
     // Update visuals corresponding to various elements here
           $w('#element_ID1').show(); // or whatever the case may be at your end
           $w('#element_ID2').hide();
           $w('#element_ID3').expand(); // etc. etc. 
      });

Hi James, It looks like the viewPort events are not being triggered. Temporarily, the below should very likely solve your problem – as it sort of tries to simulate a viewPort event by using the wixWindow.getBoundingRect() function.

David, this may also help resolve #5 on the list as well.

$w.onReady(function () {
    //Your current page code as it exists ...

    //Add the following, which essentially checks for the bounding rectangle every 500ms
    //and then based on the Y scroll position enables / disables the colored / transparent header
    //You can find the height of your header by selecting the header element and selecting 
    //Tools->Toolbar
     setInterval(() => {
        wixWindow.getBoundingRect()
        .then( (windowSizeInfo) => {
            /* Showing this section, so you know what else is available 
            // in case you need to use it to control your UX visualization
            let windowHeight = windowSizeInfo.window.height;      
            let windowWidth = windowSizeInfo.window.width;        
            let documentHeight = windowSizeInfo.document.height;  
            let documentWidth = windowSizeInfo.document.width;    
            let scrollX = windowSizeInfo.scroll.x;                
            */
            
            let scrollY = windowSizeInfo.scroll.y;      

             //Replace 150 with whatever the pixel height of your hearder is
              //You can find the height of your header by selecting the header element 
              //and selecting Tools->Toolbar 
             if (scrollY > 150) {
                 console.log("Within OnReady: Going to show colored header"); 
                 $w('#transparentHeader').hide();
                 $w('#coloredHeader').show();
             } else {
                 console.log("Within OnReady: Going to hide colored header"); 
                 $w('#coloredHeader').hide();
                 $w('#transparentHeader').show();
             }
         });
    }, 500); // This is set to repeat at 500 ms, change as required
});

Just simple repeaters seem like to be break too if you stretch your window brower the elements are in total disorder : https://www.screencast.com/t/XwroCX2vc

@skmedia Thank you for your reply! I tried to split it up with the backend function but it doesn’t appear to have any effect.I should be able to pass a query (txlist) into a dataset filter using the code I had before though correct? Just want to make sure I am trying to do it correctly.

My #WixLocation buttons and forwarding after triggered code seem to be working again… I have had to change all my links to FULL URL’s instead of the (“/pageA/pageB”) variation.

None of the linked buttons (via the “connect to database method”) work in the #repeaters. I changed my button links to onReady / onClick / $item and made the repeater fully coded and the buttons only worked for the first populated X amount. After filtering, the buttons stopped. So, a fully coded repeater will work with onClick if you’ve got a smaller database.

As a little work around, I’ve made my ID numbers visible in the repeaters. I now click to copy them to an empty input and click another existing icon to use the data in the input to forward to a page via WixLocation using a FULL URL. Messy, but works a temporary fix. Ok, if your system is backend, but useless really if it’s for public use!

onClick events no longer work for Repeater Containers on my live site, they now only work in preview mode

well done wix , very professional

Hey Reverse, that is very weird…what is going on there? Do you have two repeaters side by side or is it just one repeater that’s doing this weird thing?

What kinds of onClick events, Mike? I had some onClicks break on repeaters on my site but they were links I was able to fix by using template literals.

@tabraham In my case, viewport functions are working just fine… it was a specific hide/show function in the onClick that was preventing the whole onClick script from running. I was able to fix this only by changing my design…

@poolshark314 I’m not exactly sure as I’ve never had to do the same thing. When you console.log txlist, does it return the correct array? If it does, try using txlist[0] as your filter to see if it runs correctly,

If not, then you might have to use a different script. Let me know.

@thomasanthony Have you tried concatenating the missing part of the URL to a template string thomas? In my case, this is all I had to do to my repeater links to get them working again.

i.e. instead of :

const itemLink = itemData.link;
wixLocation.to(itemLink)

I used this, which is far better practice anyway:

const itemText = itemData.text;
const itemLink = itemData.link;
$w('#text').html = `<span><a href ="/missingurlstring+${itemLink}">${itemText}</a></span>`;

Updated thread with fixes, if you have any more please post them and I’ll append them.

@skmedia

$w(‘#repeaterContainer’).onClick((event) => {

    console.log("container has been clicked"); 

})

@mikemoynihan99 If you apply the code to a transparent button on top of your repeater items does it work?

@skmedia
My code has worked for months without issue on my site
My page code has not changed
I make copies of my of my site every week for backups
The onClick stopped working 10 days ago on my live site but still works in preview mode in editor
It also stopped working on all my site backups for the last year
This means wix have broken something at their end
The wix support team could not fix it so they refereed it to the wix development team
The wix development team emailed me today stating that they still did not have a fix for it