Redirect users to current page and refresh it at the same time

Hey Bubblers,

Currently, I have a marketplace and in the product page, there are recommendations like any other marketplace. If a user clicks a product from the recommendations, they will be redirected to the same page with a different product.

The problem is:

  1. If I don’t add “scroll to element” in the workflow, the page’s product will simply change without returning to the top page
  2. I use a decent amount of states so if a user clicks a product and gets redirected to the same page, the states are still there. I tried adding “refresh page” but it will not work since “go to page” should always be at the end of any workflow

Currently I’m doing this:

  1. Refresh the page > go to page (current page with x data to send)
  • The purpose of the refresh is to reset the states and scroll back to the top part but it will still take a few seconds to “go to page” - users would still see the previous product (poor UX)

If there was only a way for me to use “go to page” and refresh it at the same time…

Would love to hear your insights or ideas if you have any :slight_smile: I’d greatly appreciate it <3

Hello @ntabs

Create a custom event that has all the needed actions to clear all states on your page. Call it “clear all states”

And use it from any and all needed actions in your logic :smiley:

4 Likes

@cmarchan

Why haven’t I thought about this? I keep on overcomplicating things haha :man_facepalming:

Appreciate this so much @cmarchan!

1 Like

“Go to external website” does exactly this. Just feed your own URL back into it along with any parameters you may need!

1 Like

It opens another website or tab, right?

I see it working but as much as possible, I want to keep the users engaged in one tab.

Try it for yourself and see. It does not open another window or tab and does exactly what you’ve asked about: to go to a page and refresh at the same time.

1 Like

Tried it and it worked. I’ll keep this in mind for future builds. Thanks for helping out! @BrianHenderson

1 Like

Thanks, Brian! This helped me fix an issue I was having. I hadn’t tried it because I thought it would open a new tab but it works perfectly!

1 Like

It’s my pleasure, @telaholcomb !

It was an “aha!” moment for me when I realized I could use it that way. Users for my app were staying on one page for sometimes days on end (it’s a point-of-sale system) and I needed a way to force a refresh after certain actions to avoid intermittent issues.

Bubble is pretty good about surfacing new data but often there’s nothing better than a good ol’ page refresh.