Budibase / budibase

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MariaDB, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀
https://budibase.com
Other
22.47k stars 1.55k forks source link

On screen load doesn't seem to be triggering for apps in preview mode #13390

Closed ConorWebb96 closed 6 months ago

ConorWebb96 commented 6 months ago

Checklist

Hosting

Describe the bug On screen load isn't triggering on previewed apps. This does seem to be working for published apps, this makes it a bit of a pain to check your on screen load actions. As you need to publish every time you make a change to see it being affected.

To Reproduce Steps to reproduce the behavior:

  1. Go to your design screen
  2. Add an update state action with the value of test to your on screen load
  3. Reference this in a paragraph component
  4. Click the preview button
  5. See error - no test is outputted.

Expected behavior On screen loads should trigger in preview mode as well as published apps.

Screenshots

Screenshot 2024-04-03 at 09 47 32 Screenshot 2024-04-03 at 09 47 47 Screenshot 2024-04-03 at 09 48 00

App Export If possible - please attach an export of your budibase application for debugging/reproduction purposes.

linear[bot] commented 6 months ago

BUDI-8141 On screen load doesn't seem to be triggering for apps in preview mode

esellier commented 6 months ago

Hi, As a workaround, we use the Interval plugin with an initial timer at 1 sec (which is not perfect, but we cannot have less). The timer actions:

The Interval plugin is of course not displayed (Display component in frontend set to false in builder). Conditions : Hide component if {{ State.Init }} is not empty Hiding the Interval component just stops it.

That makes the job even though it's not perfect. We could improve it by checking the document.readyState==="complete" in step 1 of the Interval's actions.