I have created a workflow on page is loaded. It should create a new profile record when a cookie is not set.
I have created the workflow step…
Create a new profile
Only when UserIDCookie Values:first item is empty
In the debug I can see that the is empty = no yet it still creates the profile thing. I can also see that the correct cookie is returned. I also tried the same workflow using a custom state instead of the cookie but have the same problem. Is this a Bubble bug or am I missing something here?
Have you tried adding a Terminate This Workflow action with the condition UserIDCookie Values:first item is empty before the Create a new profile action?
i.e. the workflow action to create the thing is firing before the cookie has been read (and thus, is empty, at least at the time the condition is evaluated)
Try delaying the action to see if that works (maybe run it when the entire page is loaded, instead of on pageload)
Thanks but I can see how it is evaluated in the debugger, would this also show incorrectly in a timing issue?
The debugger won’t show you how it’s actually evaluated when it runs… (only the evaluation at the time you’re looking at it in the debugger)… so you can’t trust what the debugger shows in this case.
I’m running it on the action page is loaded, does this not wait for the entire page?
No, page load workflows will trigger as soon as the page starts loading.
Use an only when condition (only when entire page is loaded), or try using a custom event for your cookie reading action, which will force it to complete before your create a thing action.
Ah, I have to take that back it is not solved. I tried adding when entire page is loaded also added a pause if entire page is not loaded. The workflow continues regardless.
It seems to correctly retrieve the cookie but will not terminate if the cookie is not empty.