Page workflows not firing on Home page on first load

I have just published my app, and I noticed that on the first time hitting the app (e.g., going directly to the homepage), the page workflows are not firing.

These page workflows make calls to the database to present dynamic data, so I can tell they aren’t being called because the data isn’t showing on the screen.

Also, looking at the Network panel, no requests are being sent to my database (Supabae) on the first load (see screenshot)

When I click around and come back to the Home page, the page workflows are fired, and requests are made to the database (see screenshot).

I have tried changing the Trigger Event of the page workflow from

  • On page load
  • On page load (before fetching collections)
  • On app load
  • On app load (before fetching collections)

None of them seem to work.

Anyone?

@Joyce @aurelie @Broberto @danlopes ?

I could use some help here!

I can’t ship my MVP if the first page people will see is an EMPTY page!

It would be helpful to see a video showing your setup and what’s happening. It’ll be difficult to help otherwise. :smile:

1 Like

Thanks @Micah !

Here’s a video: CleanShot 2024-10-27 at 16.18.58 · CleanShot Cloud

Hmmm just a thought, have you tried putting a delay on the on page workflow? Try a 5sec delay as the first node and if it works, try decreasing it

I added a Custom JS node with setTimeout(5000);

The page workflow doesn’t seem to respect it – it just continues on! Haha

Trying using the built in weweb one, time delay

That seemed to work, but it was a bit unreliable.

In the Editor environment, the first time, the requests returned null.

I published the site anyway, and it works. It’s just an odd interaction/experience, as things do not appear until 5 seconds later.

I checked the Editor environment again after this, and it seems to work now. Still, the same odd experience of waiting.

I’m hoping there’s a better solution.

Hi,
Do you have caching set up for some APIs?

What’s likely happening is your on page workflow is executing before your component is fully rendered, therefore it runs nothing. The delay ensures it has time to render.

It would be best to reorganize your workflows and have your component workflows trigger on mount.

On Mounted results in the same issue as before. That’s why I don’t use it.

I just tried it again, and sure enough, the data isn’t being requested/retrieved.

HI @Vi56

Not that I’m aware of. I’m using the free tier of Supabase for this project, and I haven’t configured anything – it’s all default out-of-the-box settings.

Marking this as a bug.

  • Trigger page workflows do not fire properly on any event
  • Component workflows do not fire on mounted

Is there a way to send a support request formally?

I don’t think either of the issues you’ve described are bugs, more-so the way things are setup. :smile:

I’d have to take a deep look at how you’ve set things up, but you likely have other dependencies required for the workflows that aren’t being loaded in the correct order, causing things to look like they’re not firing, when they actually are.

Hi Micah,

I can’t tell if you’re trying to help, but I assume you are doing your best to guide me in resolving this.

Consistently, I have had the experience with the on mounted lifecycle event not firing properly.

I’m not aware of these dependencies you speak of. If you have an idea of what sort of dependencies I should look into, especially if there is something specific, that would be more helpful.

As far as I know, WeWeb doesn’t provide access to “dependencies” as I know them in a traditional coding environment. The “No-Code” aspect is supposed to abstract from that level of detail/control.

So, I’m using everything out of the box.

Thanks for giving your best effort; however little or as much as you can is appreciated.

@Vi56 if you have any other ideas, I’m happy to look into them as well.

Still waiting to hear back from the WeWeb folks, but they seem to be sleeping on this one.

Hi,

Try to move your workflows to On component created event of the initialized components. From what I can see you are trying to execute workflow in non-existing component and from your video I can’t tell if it is on the page.

I’m sorry, I don’t really know the exact solution, but it could be that there’s an issue with how the page is initializing the workflows on the first load. Sometimes, if certain scripts or resources haven’t fully loaded, workflows tied to the “On page load” event might not trigger as expected.

If you already have tried adding delay idk…