3 DAYS! wixLocation.to completely stopped working

Hi

I’ve deduced it’s definitely my #wixLocation . My wixLocation.to uses my members userId to navigate the site to their dynamic pages and it’s finding their Id numbers just fine.

NOTE: It was working just fine before. It has now completely stopped working on it’s own accord (I haven’t changed, updated or amended my code in any way).

  1. I’ve checked the URL’s of the destination sites and they match up. I’ve have even manually typed the URL from the saved database itself into the search bar and it all pops up just fine.

  2. The preview site is working just fine with the wixLocation.to links I have on it

Another issue to note, is that even the buttons that are connected to Data in my repeaters where I set it to “click action connects to…” don’t read either. I’m guessing WIX uses wixLocation.to to re-direct those as well.
Any more updates on wixLocation.to would be much appreciated when people get them. My site is now just a popup saying “we’re updating a few things”.

The WIX email help guys just keep forwarding me back here and I haven’t heard anything.

The strangest thing was, it was down for a day, then randomly the wixLocation came back online for about an hour and worked properly, then went back offline again…

Nudge

Can you provide a snippet of the code which is not working

1 Like

Hi Shan

Many thanks for the help!

Here’s a couple of examples of things that aren’t working anymore (they were all working just fine a couple of weeks ago):

1. The onLogin to send the customer to their account: (written in the site tab of the code panel)

import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';

$w.onReady(function () {

  wixUsers.onLogin( (user) => {
    let userId = user.id;           // "r5cme-6fem-485j-djre-4844c49"
    wixLocation.to("/Members/" + userId); 
  
  } );    
  
} );
  1. The button to send the customer to their account: (written in the site tab of the code panel)
export function button4_click(event) {
$w("#box5").hide();
let user = wixUsers.currentUser;
let userId = user.id; 
wixLocation.to("/Members/" + userId); 
}
  1. The buttons aren’t even registering that there is a link attached (when you right click it) - i’d expect it to register and just send me to a broken link page.

This is an example of the link it’s trying to find - when you copy the path into the URL bar the page shows up no problem.

The same issue of not registering a link is the same on the repeaters I have that are linked using the dataset connection method (no code) - these are linked to my /Members/Admin/ + userId pages.

It’s also the same on the other pages:
This button should take a moderator to a different dynamic page owned by the user. This is an example of it not working from code on a the page code tab (not site code),

import wixUsers from 'wix-users';
import wixLocation from 'wix-location';

export function button13_click(event) {
let id = $w("#text50").text;
wixLocation.to("/Members/Admin/Earned/" + id);
}

When you click it, it just shows: www.“mysite”.com/blank-5. However, the page exists if you just copy the link from the database into the URL.

It’s really weird as it was working fine and has been doing for weeks prior to it just stopping.

Looking forward to hearing from you.

Kind regards

Thomas

For button4 you are redirecting based on the User ID instead of the Item ID from the database. You need to get the Item ID from the database and use that.

For button13 which I assume is inside a repeater you should do this because $w parameter has been removed from the event handlers.

export function button13_click(event) {
    let $item = $w.at(event.context);
    let id = $item("#text50").text;
    wixLocation.to(`/Members/Admin/Earned/${id}`); //use backticks here ``
}

If button13 is not inside a repeater then try this:

export function button13_click(event) {
    let id = $w("#text50").text;
    wixLocation.to(`/Members/Admin/Earned/${id}`); //use backticks here ``
}

Hi

Thanks for the reply.

I have changed the format to ‘backticks’ and it’s still not registering. Has something changed with WIX in the last week? Everything was working fine, and has been for the longest time. It’s now just stopped.

The user ID and Item ID is the same from my database. For the ‘my account’ pages attached to button 4, These buttons take the user to their own account pages which are registered with their own userId

I set the input on the page to display the current user Id to check if they are the same. And they are (this is mine) - by the way, it seems to be working fine when in preview mode, just not live mode?

Sorry for the confusion on the repeater buttons and button 4. The button on the repeater is attached through the database connection tool. It shouldn’t need any code. But that still is not working either.

Button 13 is on the page attached to the last image. I have changed the code to match yours (with the back ticks) but it still doesn’t work.

Many thanks again

Thomas

Can you try the full URL like this

wixLocation.to(`https://www.mysite.com/Members/Admin/Earned/${id}`);
1 Like

Hey Shan

Many thanks, that one worked. It’s weird the other way of doing it has stopped - it was working fine before. I’ll just change the repeater to onClick instead and work my way through my site to change the rest of my wixLocation.to’s to the full URL.

The non-dynamic page links still work, like this >

wixLocation.to("/pageX/"); 

Thanks again

Thomas