Popup Group Clears When Workflow Starts

My app has a variety of data types which the user can add and delete items. Some of these include Area, Context, Contact, etc.

When the user clicks on a delete icon for an item, it sets the state in a popup. The popup is used as a confimation dialog.

For example, if the user is deleting an Area, after clicking the delete icon, the popup’s state Area is filled with the one the user wishes to delete. This is confirmed to work correctly. In this example the name of the Area to delete is Delete this area. (Clever, I know…)

In the popup, there is a Delete button. When clicked it starts a workflow where it should only delete an Area if the Area state of the popup is not empty.

The problem that I cannot figure out is that as soon as I click the Delete button, when step-by-step is on in the debugger, before even evaluating any of the steps of the workflow, the popup’s Area state is cleared. I know this because I added a text field to display that state in the popup. The Area is correctly displayed before clicking Delete, but disappears as soon as I click Delete and before any of the steps have executed.

This is causing the workflow to skip the step to delete the Area because the state is empty and the condition fails.

Here is what is even more strange. The area is deleted from the database even though the step is skipped. Also, the empty state causes other steps to execute even though they should not. It was this extra behavior that alerted me to the issue. (It’s deleting an entirely different list which should not be deleted.)

Any ideas? I’m stumped.

Run step by step is not totally reliable because sometines, an action already run before it reach this step (so when you reach this step, it may return false even if when it did run it was true)… Custom event should run step by step.
To understand more about order of operation, please read this: Actions | Bubble Docs
Also, the state item is deleted… this is why it disappear from display

Thank you. I’m aware that it is not 100%, but this is completely not making sense.

The last step in the workflow clears all of the states for next time. So I disabled this step to make sure it won’t run and it didn’t change the result. Before any steps at all have run (clicking the Delete button initiates the workflow), the state gets cleared, but the step still runs (deletes the thing) even though it’s condition fails.

Even though the behavior is more or less what I want, I feel like I need to clean something up because I don’t want unexpected behavior later.

There is nothing that should cause the state to clear, yet it still does.

Your state is of DB type right? So what happen is that you delete this item. Even if the state is not empty, this item doesn’t exist anymore and related data too. So the display will be empty, but not the state. You can even try this with a RG. Set state with a list of DB thing and use a button to delete the first thing. You will see that the data disappear but the row remain

The state is cleared before the Thing is deleted. As I showed in the screenshot, the state clears before any of the workflow steps execute. And the step that deletes the Thing fails the condition of the state being not empty. I’ll grab a screenshot of that later today.

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