Deferred show of elements

I would like to implement a time deferred showing of elements when the button is clicked. Let’s say I want an element to show 15 seconds after the button was pressed.
Is it possible?

Not really. You could hack something with the Do Regularly event, modifying a custom state to make sure the event doesn’t run more than once though. That would def work, but it’s a bit hacky. We don’t have that feature yet.

Hi Emmanuel,
I’ve had an idea how to go about this, here it is:

  1. I configure a workflow for the first button to set a custom state of the second button to the current date/time. And also call a custom event
  2. in the custom event the condition is when the current time minus the second button’s time is equal or more 15 seconds then show the second button.
    this looks like it should work but it doesn’t.
    as for the do every 5 seconds event, it’s going to run at the background all the time if I configure it or it can be called only once from the workflow of the first button?
    Thanks,
    Levon.

It would be run more than once, but that’s where a custom state is handy, to mark the workflow as run ‘once’, and not run it after.

Why don’t you put that on a new page on the forum_app so that we can work on a real case: https://bubble.io/page?type=page&name=index&id=forum_app&tab=tabs-1

Emmanuel, done, Please see the page levon1.
There are 2 buttons. Initially the first one is visible the second one is not.
there are 2 workflows:

  1. when the first button is pressed the second button’s custom value’s state changed to 0
  2. do every 5 second and when the second button’s custom state is 0- change the custom state to 1

and lastly there is a condition of button 2 when its custom state is 1 make the button visible.
but it doesn’t seem to work.
What have I configured wrong?

Have you tried using the step-by-step debugger? You should use it, it’s very useful in this kind of situation.

In your case, I think the logic is fine, but you’re not showing any element in the Do every 5 sec workflow… So nothing will happen. I added an icon and it works. Check it out.

indeed it works! so is it ok to use this way or you wouldn’t recommend it? Will it affect processing speed or it won’t be felt at all?
I use the debugger on my app and yes it’s very handy. But here I didn’t know how to enable it. In my app it’s turned on by default.

It should be fine to use this.

What do you mean by the debugger is off? Do you see it at the bottom of the page after hitting preview?

in case of the forum app I don’t see anything at the bottom. The page opens as


but even if I try to open it like this:

it still goes to the previous URL without the debugger

You’re right, we’re not showing the debugger on public apps. I’ll change that today.

just realized that the “do every 5 seconds” event cannot show/hide elements within the repeating group. Is that a bug?
also, when this event is configured the debugger shows that every 5 seconds this event checks the custom state, so it kinda runs all the time in the background. Not sure if it would affect the performance.

It’s not a bug, it’s just that the workflow won’t be able to know which entry in the repeating group is in the context. So you can access the elements inside in the repeating group if you’re already in it. A button in a repeating being clicked would work, but a Do Regularly won’t. Think about it…

The cost of running that is quite low, so performance wise it should be safe. Again, what you’re trying to do is very particular (in fact, I can’t think of any website that i’ve visited that does that), so it’s okay. Don’t do it everywhere (it wouldn’t be great UX i think).

ok, i found a way around this. I make the “do every 5 seconds” event change the custom state of the repeating group and based on that custom state the buttons inside of that custom group become visible or hidden.
I won’t use it more than once on the page. you are right, it’s very particular - but it’s part of the concept.
Thanks!