Is there a way to refresh the current page?
Or, redirect_to :back (to the previous page) and force a page refresh?
Hi Adam,
what are you trying to implement? didnt you find this api helpful wix-location-frontend - Velo API Reference - Wix.com ?
Shlomi
Unfortunately wixLocation API DOES NOT WORK!
For example, I tried following function:
export function reloadPage() {
let link = â/zvorotnij-zv-yazok?rnd=â + Math.floor(Math.random() * 1000);
console.log("-> navigate-to: " + link);
wixLocation.to(link);
}
The idea is to reload CURRENT PAGE! Because database collection content was changed and I need to re-display current page with new content.
Hi,
If you want to refresh the data you can refresh the dataset, check it out here .
I found this somewhere and it works. Hope it helps
wixLocation.to(wixLocation.url);
This helps. I had to change it to wixLocation.to(wixLocation.url) but it works.
My problem now is that it happens before the rest of my code finishes. Itâs at the bottom of an .onClick event and before all the code runs, this takes effect.
Any idea how to delay this portion?
@dwyanekrzanowski you can use setTimeout. If you search Google for âwix code set timeoutâ, youâll find the answer.
@webmasterq I actually got it to work by using a .then before the wixLocation code. I just had to set it up at the bottom of my code block.
@dwyanekrzanowski Ah yes would have been a lot easier haha!
A simple way to solve this is to create a new page call it refresher when this page loads the DOM in the onready event use logic to redirect back to the page that you to refresh, just a simple workaround but it does work nicely
A simple way to solve this is to create a new page call it refresher when this page loads the DOM in the onready event use logic to redirect back to the page that you need to refresh, just a simple workaround but it does work nicely ⌠Obviously create an event after DB has been updated to send the user to the refresher page and once the user lands in this page take back the user to the previous page, Corvid and Wix are using React behind the scenes due to its nature and the way how a single page application(SPA) work, it wonât work a local page refresher ⌠such as location.reload()