Can I reload a page with new data?

The Go To Page function does not work if I am already on the same page. For example, if someone wanted to go straight from one product page to a different product page, it will not display the new information. Repeating the code in On Page Enter in On Click doesn’t make sense in some circumstances. For example, a member is looking at the member page for a different member, but then clicks the account icon to look at their own member page. It should reload the member page with their information, but if I use Go To Page with the same page name, even if I add query data to it, it doesn’t do anything.

Most of the time they would be on a different page when they click that button so anything other than Go To Page doesn’t make sense. I could work around with an If then statement checking the current page name, but that seems kinda clunky to do everywhere someone could possibly already be on the same page, and then repeating all of the On Page Enter code if they are.

Hello, @Jacki_Saorsail

I guess the On Page Query handler should help with this issue. If you have any trouble, just let us know!

Regards,
Serhiy

I am using on page query and it isn’t loading the new data when query parameters change. The easiest place to see this is when someone clicks on their account page from a different members page. Here is the on click logic when you click on the account page button…
useracctbtn
Here is the on page query logic on the member page (same page for member account and viewing other member’s profiles)…
memberpagequery
Here is where that parameter is used in On Page Enter, which should load the data on the page…
onpageenter
Instead I’m just getting an empty page. It isn’t even loading the page elements and it isn’t giving me an error. I added Print parentObjectId at the top of On Page Enter and it prints it correctly when going to the page from a different page, but when I use Go To Page from the same page, it doesn’t print anything and the page goes blank.

Hello @Jacki_Saorsail

In your case, the page renders data from the page data (for example “name”).
The first time you set “name” in the “On Page Enter” handler. So, to render new “name” on query changes, you must update the property “name” in the “page data” in the “On Page Query” handler.
I recommend you create a function “onMemberIdChange” that takes the argument “objectId” and moves the logic from the “On Page Enter” handler (not all of it, but only what concerns loading or updating the user). Then use it in the “On Page Enter” handler and in the “On Page Query” handler.

Regards

Thank you! I did have to turn the visibility of the elements off and then back on again at the end of the function to be able to see the updated info, but it worked!