Anyone know how to check if current page thing is deleted?

Greetings, all! Is it possible to check if the current page thing has been deleted in some sort of conditional? There could be cases where an admin deleted a thing that a user is viewing, and I want to redirect if true.

If it’s in the database, you can do that. You make a “Do a Search for” whatever you are looking for and count it. If it’s 0 you can do whatever you want to do if it’s being deleted.
Be aware that those items must be unique in some way, otherwise you can’t rely on the counting.

Hope that helps.

Sarah

Thanks for the reply, @Sarah_Biberei! The problem I have is I have certain elements that display when the current page thing is not empty. I expected that a deleted thing would result in the current page being empty, but it appears that’s not the case. Any idea on how to do this using the Current Page Thing reference, or does it have to be search-based?

Can you may share a concrete example? I’m having some troubles imagine what you really mean.

Certainly. Let’s say I have an Event thing called “Event A”. When a user clicks a button, it sets the current page’s thing to Event A. If, while a person is viewing the event, an admin deletes Event A behind the scenes, Bubble currently doesn’t register that the event thing is deleted and still lists the deleted thing’s ID in the URL. I would have expected the page to then revert to an “empty” state, but it seems that’s not how Bubble works until a refresh of the page happens.

Okay, thanks for the clarification. What you could do is to check every x minutes when the event in this case is still available. You would use the “Do every x seconds” for that and a custom event for that.
Saying that if someone is already on this page and within the time span of x minutes if the event is being deleted, the user will be shown a pop-up or a re-direction to another page.

Many greetings.

Sarah

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.