fix: explicit automatic actions to be included in layout on load actions as well (#40778)

## Description

This PR fixes an issue in reactivity where if we have configured any
action to be automatic explicitly (By changing from settings in action
editor), then this action was not getting included in the
layoutOnLoadActions (This matrix informs frontend on what actions it
needs to execute on page load). Since we want all automatic actions to
be on page load as well, whatever actions user configure explicitly to
be automatic, should be included in page load as well. This PR fixes
that.

**Steps to test:**
1. Create an app with 2 queries -> Query1 and Query2
2. Go to Query1 -> settings and change run behaviour to be automatic.
3. Bind this query Query1 to Table1 widget
4. Reload the page and see if the table is getting populated or not

Fixes #40781   
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/15318982252>
> Commit: 0eca6f90a21ab10faaf7794a98567ccce4bef541
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=15318982252&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Thu, 29 May 2025 08:24:56 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


## Summary by CodeRabbit

- **Bug Fixes**
- Improved detection of actions set to run automatically on page load,
ensuring both "ON_PAGE_LOAD" and "AUTOMATIC" run behaviors are now
recognized. This enhances reliability for users who configure actions to
execute when a page loads.
- Refined the logic for identifying user-configured executables that
should not run on page load, now accurately recognizing only those set
to "MANUAL" run behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: “sneha122” <“sneha@appsmith.com”>
This commit is contained in:
sneha122 2025-05-29 15:01:06 +05:30 committed by GitHub
parent 2d21717059
commit 0377b37bbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -1309,7 +1309,8 @@ public class OnLoadExecutablesUtilCEImpl implements OnLoadExecutablesUtilCE {
private boolean hasUserSetExecutableToNotRunOnPageLoad(Executable executable) {
if (TRUE.equals(executable.getUserSetOnLoad())
&& executable.getRunBehaviour() != RunBehaviourEnum.ON_PAGE_LOAD) {
&& (executable.getRunBehaviour() == null
|| RunBehaviourEnum.MANUAL.equals(executable.getRunBehaviour()))) {
return true;
}

View File

@ -182,9 +182,10 @@ public class CustomNewActionRepositoryCEImpl extends BaseAppsmithRepositoryImpl<
public Flux<NewAction> findUnpublishedActionsByPageIdAndRunbehaviourSetByUserOnPageLoad(
String pageId, AclPermission permission) {
BridgeQuery<NewAction> q = Bridge.<NewAction>or(
// First condition: new runBehaviour = ON_PAGE_LOAD
Bridge.<NewAction>equal(
NewAction.Fields.unpublishedAction_runBehaviour, RunBehaviourEnum.ON_PAGE_LOAD),
// First condition: new runBehaviour = ON_PAGE_LOAD or AUTOMATIC
Bridge.<NewAction>in(
NewAction.Fields.unpublishedAction_runBehaviour,
List.of(RunBehaviourEnum.ON_PAGE_LOAD.name(), RunBehaviourEnum.AUTOMATIC.name())),
// Second condition: legacy executeOnLoad = true
Bridge.<NewAction>isTrue(NewAction.Fields.unpublishedAction_executeOnLoad))
.isTrue(NewAction.Fields.unpublishedAction_userSetOnLoad)