Forum Academy Marketplace Showcase Pricing Features

When Page is Loaded - Trying to set state, only works on debug slow

Hello,

I thought I had a pretty normal situation here, it’s worked before but suddenly today I can’t for the life of me get the page is loaded to set state for the 1T DayOfWeek object. When I go to preview the page loads, but the state for the object isn’t getting set…sometimes. Other times it works, but mostly it doesn’t. It will work, however, if I click on the “SLOW” debugger button to watch it load the page, works fine then, but not on a normal load. Has anyone else had this issue or anything similar?

I’m not really sure how to share my app for you to see, but here’s the URL for it:

Much thanks everyone,

David

We cannot access to your app. You need to go in setting and set Public view mode in General tab

So sorry, it should be enabled now, thanks!

Which custom state is the one you’re having problems with?

I may be off the mark here, but it looks like an order-of-operations issue

Little known fact:
There is no guarantee that bubble workflow steps will execute in sequential order or, more specifically, that the data from a previous step will be ‘ready’ for the next step.

In some cases (when using server-side actions or APIs) you can include the result of step x in a step and it will wait for a result before running the next step, but when writing to page states (locally) there is no way to know if that has been completed to memory before the next step runs. You’ve got a few workflow steps that read and write to page states in rapid succession, so this could be your issue.

In reality, writing to a page state and reading from it in a subsequent step works most of the time, but you can’t always rely on that.

Have you tried including short pauses between each step? Rather than trying to do a linear workflow you can also try an event based approach for reliability. For example: create a conditional workflow when state is not empty which then runs the following steps.

2 Likes

To continue on what jon2 say, Create a custom event that will have the step 1. move the step 1 in custom event and in the Page load, step 1 should trigger the custom event first. This will make sure that this step is completed before processing the rest of the WF

I don’t say it’s the problem, but it’s possible.

1 Like

Hello jon2, thanks much for that information, that explains a lot. I’ll make some changes and do some tests to see if your solution works and let you know. Thanks!

Thanks Jici,

I’ll give that a shot!

Kind regards,

David

1 Like

It appears that if I use custom events as you all suggested it works much better, so thanks for that. I learned something from all of you once again, thanks so much!

Now I’m having a different problem, though, when I change a selection in the TimeFrame DropDown, just selecting “Current Week”, the console shows an error, and when I look at the dev tools in Chrome I keep seeing an error message “Maximum call stack size exceeded”. Why is this happening? It apparently doesn’t like that I’m calling a custom event which is in turn searching for a Thing in my DB on DropDown change. Any ideas? Or should I create a new topic with this issue?

I think it may be a bug if the error happen on a Bubble step (Seem to be linked to Set state). You can start a new topic but I think you should submit a bug ticket for that. I don’t see an reason for this error actually.

1 Like

Thanks Jici, will do.

Kind regards,

David