Skip to content

fix: Updating JSFunctionSettings unit test to fix failure #40480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ankitakinger
Copy link
Contributor

@ankitakinger ankitakinger commented Apr 29, 2025

Description

Updating JSFunctionSettings unit test to fix failure

Fixes #39833

Automation

/ok-to-test tags=""

🔍 Cypress test results

Warning

Tests have not run on the HEAD d74c7de yet


Tue, 29 Apr 2025 16:47:47 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Introduced a "Run behavior" dropdown for actions, queries, and APIs, allowing users to select between "On page load" and "Manual" execution modes.
    • Added descriptive subtext to run behavior options for improved clarity.
  • Enhancements
    • Replaced the previous "Run on page load" switch with a more flexible run behavior selector across the UI.
    • Updated editor and settings panels to reflect the new run behavior configuration.
  • Bug Fixes
    • Ensured consistent handling and synchronization of run behavior settings throughout the application.
  • Documentation
    • Updated tooltips and labels to clarify run behavior options.
  • Tests
    • Added and updated tests to cover the new run behavior feature and its integration.
  • Chores
    • Updated internal configurations and test data to use the new run behavior property.

Copy link
Contributor

coderabbitai bot commented Apr 29, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • pg
  • release

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This change migrates the action execution behavior configuration from a boolean executeOnLoad flag to a more expressive runBehavior enum or string property throughout both frontend and backend codebases. On the frontend, UI controls for executing actions on page load are updated from switches to dropdowns, with all related Redux actions, reducers, sagas, and constants refactored accordingly. The backend introduces a new enum, synchronizes the new property with the legacy flag for backward compatibility, and updates API endpoints and DTOs. All relevant test cases, fixtures, and configuration files are modified to use the new property and control type.

Changes

Files / Groups Change Summary
app/client/cypress/support/Pages/JSEditor.ts Updated CSS selectors for run behavior UI elements to match new class names and roles.
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts Added ActionRunBehaviour enum, RUN_BEHAVIOR metadata, RUN_BEHAVIOR_VALUES, and type alias for run behavior.
app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts,
app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts,
app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts,
app/client/src/entities/Action/actionProperties.test.ts,
app/client/src/pages/Editor/JSEditor/utils.test.ts,
app/client/src/utils/DynamicBindingUtils.test.ts,
app/client/src/utils/JSPaneUtils.test.ts,
app/client/test/factories/Actions/API.ts,
app/client/test/factories/Actions/GoogleSheetFactory.ts,
app/client/test/factories/Actions/JSObject.ts,
app/client/test/factories/Actions/Postgres.ts,
app/client/test/factories/MockPluginsState.ts
Replaced executeOnLoad with runBehavior in test data, factories, and mock plugin states. Updated values and UI control types accordingly.
app/client/src/actions/pluginActionActions.ts Renamed action creators and payloads to use runBehavior instead of executeOnLoad. Updated Redux action types and signatures.
app/client/src/api/ActionAPI.tsx Renamed and updated API method to set runBehavior instead of executeOnLoad; changed endpoint and payload.
app/client/src/api/PageApi.tsx Changed response data interface to use runBehavior property.
app/client/src/ce/constants/ReduxActionConstants.tsx Updated Redux action types and error types to use runBehavior naming, removing old executeOnLoad types.
app/client/src/ce/constants/messages.ts Updated UI message from "run on page load" to "run behavior".
app/client/src/ce/reducers/entityReducers/actionsReducer.tsx,
app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx
Refactored reducers to update runBehavior property and handle new action types and payloads.
app/client/src/ce/sagas/PageSagas.tsx Updated saga to dispatch new run behavior actions.
app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts Updated default app state and config to use runBehavior and dropdown control.
app/client/src/components/editorComponents/utils.test.ts Updated test fixture to use runBehavior and imported new enum.
app/client/src/components/formControls/DropDownControl.tsx Enhanced dropdown rendering to support subtext and set fixed height.
app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts,
app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts,
app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts
Changed config from switch for executeOnLoad to dropdown for runBehavior with options and subtext.
app/client/src/entities/Action/index.ts Changed BaseAction interface: replaced executeOnLoad with runBehavior property.
app/client/src/pages/Editor/EntityNavigation/JSObjectsPane/index.ts Updated tab logic to check for runBehavior instead of executeOnLoad.
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx Updated tests to validate dropdowns for run behavior instead of switches for execute on load.
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx Refactored UI from switch to dropdown for selecting run behavior; updated logic and analytics.
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/types.ts Changed update settings prop type from boolean/number to ActionRunBehaviourType.
app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json,
app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json
Updated plugin config JSONs to use runBehavior dropdown instead of executeOnLoad switch.
app/client/src/sagas/ActionExecution/PluginActionSaga.ts Updated logic to check runBehavior for clearing action responses.
app/client/src/sagas/ActionSagas.ts Refactored saga logic and watchers to update runBehavior instead of executeOnLoad.
app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts Updated test fixture to use runBehavior.
app/client/src/sagas/JSPaneSagas.ts Refactored saga logic and watchers to update runBehavior for JS functions.
app/client/src/utils/FilterInternalProperties/JsAction.ts Updated logic to use runBehavior for peek data assignment.
app/client/src/utils/JSPaneUtils.tsx Updated utility functions to use runBehavior instead of executeOnLoad.
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/RunBehaviorEnum.java Added new enum RunBehaviorEnum with MANUAL and ON_PAGE_LOAD.
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java Added runBehavior field (default MANUAL), deprecated executeOnLoad.
app/server/appsmith-plugins/*/setting.json Changed plugin settings: replaced executeOnLoad (switch) with runBehavior (dropdown) and updated options/labels.
app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java Added new endpoint for setting run behavior, deprecated old executeOnLoad endpoint.
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java Added new service method to set run behavior.
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java Implemented run behavior setter, ensured bidirectional sync with executeOnLoad for compatibility, updated action creation logic.
app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java Added tests for run behavior and executeOnLoad synchronization and persistence.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI (Dropdown)
    participant Redux/Saga
    participant Backend API
    participant DB

    User->>UI (Dropdown): Selects run behavior (Manual/On Page Load)
    UI (Dropdown)->>Redux/Saga: Dispatches SET_RUN_BEHAVIOR action
    Redux/Saga->>Backend API: PUT /runBehavior/{actionId} with behavior
    Backend API->>DB: Update action.runBehavior and sync executeOnLoad
    DB-->>Backend API: Persisted action
    Backend API-->>Redux/Saga: Return updated action
    Redux/Saga-->>UI (Dropdown): Update state/UI with new run behavior
Loading

Assessment against linked issues

Objective Addressed Explanation
Fix any cypress or unit test cases that fail with update of references and the update of executeOnLoad toggle to runBehaviour dropdown (#39833)

Suggested labels

Bug, ok-to-test

Suggested reviewers

  • rahulbarwal
  • jsartisan

Poem

When toggles are gone and dropdowns appear,
Our actions now run with intentions more clear.
No more just a switch, but a choice to be made—
"Manual" or "On Page Load," the options displayed.
With enums and tests all aligned in a row,
Run behavior’s the future—let’s give it a go!
🚦✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ankitakinger ankitakinger changed the base branch from feat/reactive-actions-run-behaviour to release April 29, 2025 16:42
@ankitakinger ankitakinger requested review from ayushpahwa and a team as code owners April 29, 2025 16:42
@github-actions github-actions bot added Core Query Execution Issues related to the execution of all queries IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Integrations Product Issues related to a specific integration potential-duplicate This label marks issues that are potential duplicates of already open issues Query Settings Issues related to the settings of all queries Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE Task A simple Todo labels Apr 29, 2025
Copy link

🔴🔴🔴 Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 1, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

You can view the dependency diff in the run log. Look for the check-cyclic-dependencies job in the run.

@github-actions github-actions bot added the Bug Something isn't working label Apr 29, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🔭 Outside diff range comments (1)
app/client/cypress/support/Pages/JSEditor.ts (1)

299-315: ⚠️ Potential issue

Methods need updating to handle dropdown selection instead of toggle.

The VerifyAsyncFuncSettings and EnableDisableAsyncFuncSettings methods still use boolean parameters and check/uncheck operations, but the UI now uses a dropdown with enum values.

These methods need to be updated to:

  1. Accept enum values instead of boolean parameters
  2. Select dropdown options instead of checking/unchecking
- public VerifyAsyncFuncSettings(funName: string, onLoad = true) {
+ public VerifyAsyncFuncSettings(funName: string, runBehavior = "ON_PAGE_LOAD") {
    this.toolbar.toggleSettings();
    this.agHelper.AssertExistingCheckedState(
      this._onPageLoadSwitchStatus(funName),
-     onLoad.toString(),
+     runBehavior,
    );
    this.toolbar.toggleSettings();
  }

- public EnableDisableAsyncFuncSettings(funName: string, onLoad = true) {
+ public EnableDisableAsyncFuncSettings(funName: string, runBehavior = "ON_PAGE_LOAD") {
    // Navigate to Settings tab
    this.toolbar.toggleSettings();
    // Set onPageLoad
-   this.agHelper.CheckUncheck(this._onPageLoadSwitch(funName), onLoad);
+   this.agHelper.SelectDropdownOption(this._onPageLoadSwitch(funName), runBehavior);
    // Return to code tab
    this.toolbar.toggleSettings();
  }

Note: The method agHelper.SelectDropdownOption is a suggestion - you'll need to use the appropriate helper method for selecting dropdown options in your framework.

🧹 Nitpick comments (9)
app/client/src/ce/sagas/PageSagas.tsx (2)

542-543: Improve filter condition clarity

Consider making the filter condition more explicit about what you're checking for, to improve code readability.

- const actions = actionUpdates.filter(
-   (d) => !d.hasOwnProperty("collectionId"),
- );
+ const actions = actionUpdates.filter(
+   (d) => d.collectionId === undefined,
+ );
🧰 Tools
🪛 Biome (1.9.4)

[error] 543-543: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


533-549: Consider error handling for actionUpdates

The code assumes actionUpdates is an array. Consider adding a null/undefined check before filtering.

- if (actionUpdates && actionUpdates.length > 0) {
+ if (Array.isArray(actionUpdates) && actionUpdates.length > 0) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 535-535: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 538-538: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 543-543: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 546-546: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx (1)

63-72: Test assertions updated to verify dropdown content.

The assertions now correctly check for the presence of "On page load" and "Manual" text in the dropdown components, using appropriate selectors to verify the UI renders correctly.

Note: The selectors used (.myFun1-run-behavior-setting and .myFun2-run-behavior-setting) are quite specific. Consider adding data-testid attributes for more maintainable test selectors if this isn't already a standard practice in your codebase.

app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java (1)

132-132: Ensure proper annotation for deprecated endpoint.

The @Deprecated annotation is correctly applied, but consider adding @Deprecated(since = "version", forRemoval = true) with appropriate version information for better maintenance tracking.

-@Deprecated
+@Deprecated(since = "your-version", forRemoval = true)
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx (1)

61-63: Analytics event property naming could be improved.

The analytics event still uses "toggleSetting" with value "ON_PAGE_LOAD" even though it's not a toggle anymore and the new value is the enum value.

AnalyticsUtil.logEvent("JS_OBJECT_SETTINGS_CHANGED", {
-  toggleSetting: "ON_PAGE_LOAD",
+  settingType: "RUN_BEHAVIOR",
  toggleValue: newRunBehavior,
});
app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json (1)

8-23: Consistent migration to runBehavior dropdown
This correctly replaces the old executeOnLoad switch with a runBehavior dropdown, bringing Oracle plugin settings in line with the new platform standard.

Nit: for clearer wording, consider this diff:

- "subText": "Query runs when the page loads or when manually triggered",
+ "subText": "Query runs automatically on page load or when manually triggered",

And likewise for the manual option:

- "subText": "Query only runs when called in an event or JS with .run()",
+ "subText": "Query only runs when explicitly invoked via event handlers or with JS `.run()`",
app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json (1)

8-23: Run behavior dropdown aligned with platform convention
The MSSQL plugin now uses runBehavior with ON_PAGE_LOAD/MANUAL options—great consistency.

Minor wording tweak for the first option:

- "subText": "Query runs when the page loads or when manually triggered",
+ "subText": "Query runs automatically on page load or when manually triggered",
app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json (1)

8-23: Firestore plugin updated to runBehavior enum
The Firestore settings now match the new dropdown-based execution behavior, ensuring uniform UX across plugins.

Suggestion: refine the descriptive text:

- "subText": "Query runs when the page loads or when manually triggered",
+ "subText": "Query runs automatically on page load or when manually triggered",
app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json (1)

8-23: Mongo plugin adopts runBehavior dropdown
Good update—executeOnLoad is replaced with an explicit runBehavior setting, consistent with other database plugins.

Optional refinement for clarity:

- "subText": "Query runs when the page loads or when manually triggered",
+ "subText": "Query runs automatically on page load or when manually triggered",
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61d4801 and d74c7de.

📒 Files selected for processing (59)
  • app/client/cypress/support/Pages/JSEditor.ts (1 hunks)
  • app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1 hunks)
  • app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts (1 hunks)
  • app/client/src/actions/pluginActionActions.ts (2 hunks)
  • app/client/src/api/ActionAPI.tsx (2 hunks)
  • app/client/src/api/PageApi.tsx (2 hunks)
  • app/client/src/ce/constants/ReduxActionConstants.tsx (4 hunks)
  • app/client/src/ce/constants/messages.ts (1 hunks)
  • app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts (4 hunks)
  • app/client/src/ce/reducers/entityReducers/actionsReducer.tsx (3 hunks)
  • app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx (4 hunks)
  • app/client/src/ce/sagas/PageSagas.tsx (2 hunks)
  • app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts (2 hunks)
  • app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts (10 hunks)
  • app/client/src/components/editorComponents/utils.test.ts (2 hunks)
  • app/client/src/components/formControls/DropDownControl.tsx (4 hunks)
  • app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts (1 hunks)
  • app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts (1 hunks)
  • app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts (1 hunks)
  • app/client/src/entities/Action/actionProperties.test.ts (1 hunks)
  • app/client/src/entities/Action/index.ts (2 hunks)
  • app/client/src/pages/Editor/EntityNavigation/JSObjectsPane/index.ts (1 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx (5 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx (3 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/types.ts (1 hunks)
  • app/client/src/pages/Editor/JSEditor/utils.test.ts (2 hunks)
  • app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json (8 hunks)
  • app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json (8 hunks)
  • app/client/src/sagas/ActionExecution/PluginActionSaga.ts (2 hunks)
  • app/client/src/sagas/ActionSagas.ts (4 hunks)
  • app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts (1 hunks)
  • app/client/src/sagas/JSPaneSagas.ts (4 hunks)
  • app/client/src/utils/DynamicBindingUtils.test.ts (1 hunks)
  • app/client/src/utils/FilterInternalProperties/JsAction.ts (2 hunks)
  • app/client/src/utils/JSPaneUtils.test.ts (11 hunks)
  • app/client/src/utils/JSPaneUtils.tsx (5 hunks)
  • app/client/test/factories/Actions/API.ts (1 hunks)
  • app/client/test/factories/Actions/GoogleSheetFactory.ts (1 hunks)
  • app/client/test/factories/Actions/JSObject.ts (2 hunks)
  • app/client/test/factories/Actions/Postgres.ts (1 hunks)
  • app/client/test/factories/MockPluginsState.ts (4 hunks)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/RunBehaviorEnum.java (1 hunks)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java (2 hunks)
  • app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java (3 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`app/client/cypress/**/**.*`: Review the following e2e test code written using the Cypress test library. Ensure that: - Follow best practices for Cypress code and e2e automation. ...

app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
  • app/client/cypress/support/Pages/JSEditor.ts
🧬 Code Graph Analysis (12)
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/types.ts (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/api/ActionAPI.tsx (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/ce/reducers/entityReducers/actionsReducer.tsx (2)
app/client/src/ce/constants/ReduxActionConstants.tsx (1)
  • ReduxActionTypes (1281-1324)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/ce/sagas/PageSagas.tsx (2)
app/client/src/actions/pluginActionActions.ts (2)
  • setActionsRunBehavior (355-366)
  • setJSActionsRunBehavior (368-380)
app/client/src/entities/DataTree/dataTreeFactory.ts (2)
  • actions (129-156)
  • jsActions (110-127)
app/client/src/api/PageApi.tsx (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/entities/Action/index.ts (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (2)
  • RUN_BEHAVIOR (10-23)
  • RUN_BEHAVIOR_VALUES (25-25)
app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (2)
  • RUN_BEHAVIOR (10-23)
  • RUN_BEHAVIOR_VALUES (25-25)
app/client/src/actions/pluginActionActions.ts (2)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/ce/constants/ReduxActionConstants.tsx (1)
  • ReduxActionTypes (1281-1324)
app/client/src/components/formControls/DropDownControl.tsx (1)
app/client/src/ce/pages/workspace/InviteUsersForm.tsx (1)
  • OptionLabel (127-134)
app/client/src/sagas/ActionExecution/PluginActionSaga.ts (2)
app/client/src/ce/reducers/entityReducers/actionsReducer.tsx (1)
  • ActionData (18-22)
app/client/src/ce/selectors/entitiesSelector.ts (1)
  • getCurrentActions (694-702)
app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (2)
  • RUN_BEHAVIOR (10-23)
  • RUN_BEHAVIOR_VALUES (25-25)
🪛 Biome (1.9.4)
app/client/src/ce/sagas/PageSagas.tsx

[error] 543-543: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 546-546: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-build / client-build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: server-unit-tests / server-unit-tests
🔇 Additional comments (133)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java (3)

18-18: Added import for RunBehaviorEnum

Appropriate addition of the import for the new enum used in the class.


104-113: Good use of deprecation for executeOnLoad

The code properly deprecates the boolean executeOnLoad field with an informative Javadoc comment and annotation. This maintains backward compatibility while signaling the transition to the new runBehavior property.


112-113: New runBehavior field with sensible default

The addition of the runBehavior field with a default value of RunBehaviorEnum.MANUAL is a good practice. The field has the same JSON views as the deprecated field, ensuring consistent serialization behavior.

app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (2)

5-8: Clean enum definition for ActionRunBehaviour

The enum provides clear, distinct values for the two run behavior types.


25-27: Proper exports for constants and type

Good approach exporting both the values array and a type alias for use throughout the application.

app/client/src/utils/DynamicBindingUtils.test.ts (1)

123-123: Test updated to use runBehavior instead of executeOnLoad

The test fixture has been appropriately updated to align with the new field name and type.

app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts (1)

132-132: Test fixture updated to use runBehavior instead of executeOnLoad

The test fixture has been correctly updated to use the new runBehavior property with the "ON_PAGE_LOAD" value, which is the appropriate replacement for what was likely executeOnLoad: true.

app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts (2)

47-47: Change looks good - executeOnLoad replaced with runBehavior

The replacement of the deprecated boolean flag with the new enum-based property matches the migration pattern described in the PR. This ensures test data stays consistent with the JSObject schema changes.


89-89: Consistent application of runBehavior property

Good implementation of the same pattern for the second action in the test mock. Both actions now use "MANUAL" as their run behavior, which properly replaces the previous false executeOnLoad values.

app/client/test/factories/Actions/Postgres.ts (1)

34-34: PostgresFactory updated to use runBehavior

Correctly updated the factory to use the new runBehavior property. This ensures test data created with this factory will conform to the new schema expected by the application.

app/client/test/factories/Actions/API.ts (1)

66-66: APIFactory updated to use runBehavior

The API action factory has been properly updated with the new runBehavior property. This ensures consistency across all test factories that generate action objects.

app/client/src/ce/constants/messages.ts (1)

2592-2592: UI message updated to reflect the new behavior model

The ON_LOAD_TITLE message has been updated to reflect the change from a binary selection to a run behavior selection. This properly communicates the more expressive options now available to users.

app/client/test/factories/Actions/GoogleSheetFactory.ts (1)

66-66: Property update to align with new execution behavior model

The property has been updated from the boolean executeOnLoad to the string-based runBehavior with value "MANUAL", which is part of the codebase-wide migration to a more expressive run behavior model.

app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts (4)

47-47: Test data updated to use new runBehavior property

Updated the test data to use runBehavior: "MANUAL" instead of the previous executeOnLoad boolean property for the first JS action in the test fixture.


94-94: Test data updated to use new runBehavior property

Updated the test data to use runBehavior: "MANUAL" instead of the previous executeOnLoad boolean property for the second JS action in the test fixture.


242-242: Test data updated to use new runBehavior property

Updated the test data to use runBehavior: "MANUAL" instead of the previous executeOnLoad boolean property for the myFun2 action in the second test case.


289-289: Test data updated to use new runBehavior property

Updated the test data to use runBehavior: "MANUAL" instead of the previous executeOnLoad boolean property for the myFun1 action in the second test case.

app/client/src/entities/Action/actionProperties.test.ts (1)

13-13: Default action test fixture updated

Updated the DEFAULT_ACTION test fixture to use the new runBehavior property instead of the deprecated executeOnLoad boolean flag. This change maintains consistency with the updated action model.

app/client/src/pages/Editor/EntityNavigation/JSObjectsPane/index.ts (1)

84-84: Updated tab selection condition to check for new property

The condition has been updated to check for "runBehavior" in the property path instead of "executeOnLoad", ensuring that the navigation logic correctly shows the settings tab when the run behavior property is accessed.

app/client/src/pages/Editor/JSEditor/JSEditorToolbar/types.ts (1)

3-6: Type refinement for form values looks good

The change from a less specific type to ActionRunBehaviourType improves type safety and aligns with the broader refactoring from boolean flags to an enum-based approach for run behavior configuration.

app/client/src/pages/Editor/JSEditor/utils.test.ts (2)

9-9: Added import looks correct

Import of the ActionRunBehaviour enum needed for the refactored test code.


48-48: Proper conversion from boolean to enum value

Replaced the previous boolean executeOnLoad: false with the enum-based runBehavior: ActionRunBehaviour.MANUAL which properly aligns with the refactoring efforts.

app/client/test/factories/Actions/JSObject.ts (1)

33-33: Replaced executeOnLoad with runBehavior

Both JS actions in the factory have been updated to use runBehavior: "MANUAL" instead of the previous boolean flag. This matches the expected behavior in the refactored codebase.

Also applies to: 73-73

app/client/src/components/editorComponents/utils.test.ts (2)

2-2: Added required import

Import of ActionRunBehaviour enum for use in the test fixture.


34-34: Updated test fixture to use runBehavior

Test fixture now uses the enum-based runBehavior property with ActionRunBehaviour.MANUAL value, correctly matching the migration from boolean flags to enum values.

app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts (1)

18-18: Update is consistent with the codebase migration

The change from executeOnLoad: false to runBehavior: "MANUAL" properly aligns with the system-wide migration from boolean flags to the more expressive enum values.

app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/RunBehaviorEnum.java (1)

1-9: Well-structured enum with clear documentation

The new enum provides a type-safe way to represent action execution behaviors, which is more maintainable and extensible than the previous boolean approach.

app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java (2)

4-4: Import added correctly for the new enum

The import for RunBehaviorEnum is properly added to support the new method.


21-21: Interface updated with new method to support run behavior enum

The new method setRunBehavior properly complements the existing setExecuteOnLoad method, supporting the migration from boolean flags to enum values.

app/client/src/api/PageApi.tsx (2)

12-12: Import added correctly for the new type

The ActionRunBehaviourType import is properly added to support the updated interface.


73-73: Updated interface to use the new run behavior type

The change from boolean executeOnLoad to typed runBehavior in SavePageResponseData interface properly aligns with the broader refactoring effort.

app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts (2)

1-4: Import statements correctly updated for the new run behavior constants

The imports now include RUN_BEHAVIOR and RUN_BEHAVIOR_VALUES from the PluginActionEditor constants, which are necessary for the dropdown implementation.


12-16: Properly migrated from boolean toggle to dropdown selection

The configuration has been updated from a boolean executeOnLoad to a more expressive runBehavior dropdown, with proper initial value set to MANUAL. This aligns with the broader migration across the codebase.

app/client/src/entities/Action/index.ts (2)

13-13: Import added for ActionRunBehaviourType

Correctly imported the type definition needed for the runBehavior property.


143-143: BaseAction interface updated with runBehavior property

The executeOnLoad boolean flag has been replaced with the more expressive runBehavior property of type ActionRunBehaviourType. This allows for more granular control of action execution behavior beyond just on/off.

app/client/src/utils/FilterInternalProperties/JsAction.ts (2)

4-4: Import added for ActionRunBehaviour enum

Proper import added for the ActionRunBehaviour enum used in the condition check.


19-22: Updated condition to use runBehavior instead of executeOnLoad

The conditional check has been properly updated to use the new runBehavior property with the specific enum value ActionRunBehaviour.ON_PAGE_LOAD instead of checking for the presence of executeOnLoad.

app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts (2)

9-12: Import statements correctly updated for run behavior constants

The imports for RUN_BEHAVIOR and RUN_BEHAVIOR_VALUES from PluginActionConstants have been added as required for the dropdown implementation.


20-24: API settings properly migrated to use runBehavior dropdown

The API settings configuration has been correctly updated to use a dropdown for run behavior instead of a boolean toggle. The configuration now uses the runBehavior property with proper initial value set to MANUAL and options from RUN_BEHAVIOR_VALUES.

app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json (1)

8-23: RunBehavior dropdown is well-defined
The new "runBehavior" block replaces the old boolean flag cleanly. Labels, subtexts, and values align with the ActionRunBehaviour enum on the client. Just ensure the client‐side enum constants match "ON_PAGE_LOAD" and "MANUAL".

app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json (1)

8-23: Consistent dropdown mapping for run behavior
This drop‐down configuration mirrors the other plugins and correctly defaults to "MANUAL". Confirm that any analytics or telemetry hooks reference the updated runBehavior field.

app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json (1)

8-23: Dropdown controlType and options are accurate
The DROP_DOWN control and its two options cover the expected behaviors. Verify that localization pipelines pick up these new labels if you’re using i18n.

app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json (1)

8-23: Run behavior switch-to-dropdown is correct
Great replacement of the boolean flag. Ensure downstream code (sagas, reducers, API) refers to runBehavior consistently.

app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json (1)

8-23: MySQL plugin runBehavior block looks good
Consistent with other plugins. Check that the plugin’s backend schema and DTOs support the new runBehavior property.

app/client/src/utils/JSPaneUtils.tsx (5)

6-6: Necessary import for the ActionRunBehaviour enum

The import is added to support the migration from executeOnLoad boolean to the more descriptive runBehavior enum-based approach.


134-134: Replaced executeOnLoad with runBehavior enum

Properly updated from boolean flag executeOnLoad: false to more expressive runBehavior: ActionRunBehaviour.MANUAL in the action creation object.


233-233: Replaced executeOnLoad with runBehavior enum

Updated the dummy JS action configuration to use runBehavior: ActionRunBehaviour.MANUAL instead of the boolean flag.


245-245: Replaced executeOnLoad with runBehavior enum

Consistent update to the second action in createDummyJSCollectionActions function.


285-285: Replaced executeOnLoad with runBehavior enum

Properly updated the createSingleFunctionJsCollection function to use the new enum-based approach.

app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts (2)

1-4: Added imports for run behavior constants

Imports the necessary constants to support the dropdown control for run behavior selection.


12-16: Updated form control for run behavior

Migrated from a boolean switch to a more expressive dropdown:

  • Changed label from "Run the API on page load" to "Run behavior"
  • Changed property from executeOnLoad to runBehavior
  • Changed control type from SWITCH to DROP_DOWN
  • Set appropriate initial value and options from imported constants

This change provides users with more clarity on execution behavior options.

app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json (1)

8-23: Updated S3 plugin settings to use run behavior dropdown

Similar to the client-side changes, the S3 plugin settings now use a dropdown for run behavior with "On page load" and "Manual" options instead of a boolean switch.

The implementation includes descriptive subtext for each option, making the behavior clearer to users.

app/client/src/sagas/ActionExecution/PluginActionSaga.ts (2)

172-172: Added ActionRunBehaviour import

Required import for the enum used in the updated conditional check below.


1557-1566: Updated condition for clearing action responses

Modified the condition to use the new runBehavior property instead of executeOnLoad. The check action.config.runBehavior !== ActionRunBehaviour.ON_PAGE_LOAD is logically equivalent to the previous !action.config.executeOnLoad, maintaining the same functionality while using the new property.

The comment on line 1557 is also updated to reflect the change.

app/client/src/api/ActionAPI.tsx (2)

13-13: Import added to support typed run behavior.

Good addition of the ActionRunBehaviourType import to provide proper typing for the new parameter.


305-312: Method signature change aligns with backend API updates.

The method has been properly updated to support the more expressive run behavior model, replacing the boolean toggle with an enum-based approach. The API endpoint and payload structure have been updated accordingly.

app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json (1)

8-23: UI control upgraded from switch to dropdown for better clarity.

Good enhancement to the run behavior configuration:

  • The dropdown provides clearer options with descriptive labels and subtext
  • Default is sensibly set to "MANUAL"
  • The change aligns with the platform-wide migration from boolean flags to enum-based behavior selection
app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json (1)

8-23: UI control upgraded from switch to dropdown for better clarity.

Good enhancement to the run behavior configuration:

  • The dropdown provides clearer options with descriptive labels and subtext
  • Default is sensibly set to "MANUAL"
  • The change aligns with the platform-wide migration from boolean flags to enum-based behavior selection
app/client/cypress/support/Pages/JSEditor.ts (2)

54-55: Updated selector to target the new combobox control.

The selector has been correctly updated to match the new UI component type (dropdown instead of switch).


57-57: Updated class name in selector to match new component naming.

The selector has been correctly updated to use the new "-run-behavior-setting" class.

app/client/src/utils/JSPaneUtils.test.ts (11)

44-44: ✅ Correctly replaced executeOnLoad with runBehavior
The first action in JSObject1 now uses runBehavior: "MANUAL", aligning with the new enum.


86-86: ✅ Consistent runBehavior update in second action of JSObject1
The test fixture correctly sets runBehavior: "MANUAL".


154-154: runBehavior applied to first action in JSObject2
Matches the updated property name and default value.


196-196: runBehavior applied to second action in JSObject2
Consistent with the schema change.


280-280: ✅ Updated runBehavior in resultRenamedActions fixture
Ensures name-change diff includes the new property.


361-361: ✅ Updated runBehavior in resultDeletedActions fixture
Deletion diff now reflects the new enum field.


472-472: ✅ Updated runBehavior in resultChangedBody fixture
Body-change diff correctly includes runBehavior: "MANUAL".


552-552: ✅ Updated runBehavior in resultChangedParameters fixture
Parameter-change diff now carries the new property.


627-627: ✅ Updated runBehavior in resultRemovedAsync fixture
Removal of async tag diff includes the new enum field.


702-702: ✅ Updated runBehavior in resultAddedAsync fixture
Addition of async tag diff now aligns with the new run behavior.


757-757: ✅ Updated runBehavior in resultAddedAction fixture
New-action diff correctly sets runBehavior: "MANUAL".

app/client/src/ce/sagas/PageSagas.tsx (3)

91-92: Imports updated to match the new action creator names.

The imports have been correctly updated from setActionsToExecuteOnPageLoad and setJSActionsToExecuteOnPageLoad to setActionsRunBehavior and setJSActionsRunBehavior respectively, which aligns with the migration from boolean executeOnLoad to the more expressive runBehavior enum approach.


539-540: Updated action dispatch to use the new action creator.

Correctly updated to use the new setActionsRunBehavior action creator instead of the previous setActionsToExecuteOnPageLoad.


547-548: Updated action dispatch to use the new action creator for JS actions.

Correctly updated to use the new setJSActionsRunBehavior action creator instead of the previous setJSActionsToExecuteOnPageLoad.

app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts (10)

2310-2310: The migration from executeOnLoad to runBehavior looks correct.

The addition of runBehavior: "ON_PAGE_LOAD" is consistent with the overall codebase refactoring to replace the boolean executeOnLoad flag with a more descriptive enum.


2394-2394: Proper implementation of the runBehavior property.

Setting runBehavior: "MANUAL" here is the correct equivalent to the previous executeOnLoad: false setting.


10041-10058: UI control properly updated to support the new run behavior options.

The dropdown implementation with descriptive labels and subtext is appropriate for this change. The control type change from a switch to a dropdown improves the user experience by making the options more explicit and providing additional context through subtext.


10092-10109: Dropdown implementation consistent with other instances.

This implementation of the dropdown control matches the pattern established in the previous hunk, maintaining consistency throughout the codebase.


10143-10160: Dropdown settings properly configured for API components.

The run behavior options are appropriately defined for API components, with clear labels and helpful descriptions.


10223-10240: Dropdown configuration consistent with previous implementations.

The configuration for this dropdown maintains consistency with the other instances in the file.


10415-10415: JS function default run behavior correctly set.

Setting the default behavior to "MANUAL" for JS functions aligns with the expected behavior migration.


10465-10465: Consistent application of the runBehavior property.

The runBehavior: "MANUAL" setting is consistently applied to all JS functions.


10549-10549: Consistent implementation of run behavior property.

The property is correctly set to "MANUAL" for this JS action configuration.


10599-10599: Default behavior correctly specified.

The "MANUAL" setting for the final JS action is consistent with the previous configurations.

app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx (4)

6-6: Good addition of the ActionRunBehaviour import.

This import supports the transition from boolean executeOnLoad to the enum-based runBehavior property, aligning with the broader migration effort.


19-19: Test description appropriately updated.

The test description now correctly reflects that it's testing the disabled state of the run behavior dropdown, which aligns with the UI changes.


31-31: Updated test now correctly verifies dropdown components.

The test has been properly updated to verify the presence of comboboxes instead of the previous switch components, matching the UI changes from boolean toggles to dropdown selectors.

Also applies to: 40-40


43-53: Test data correctly uses the new enum values.

The test data now properly uses ActionRunBehaviour.ON_PAGE_LOAD and ActionRunBehaviour.MANUAL instead of boolean values, reflecting the data model change.

app/client/test/factories/MockPluginsState.ts (1)

6955-6973: The new dropdown control for run behavior looks good.

The change replaces a previous boolean switch for "executeOnLoad" with a more expressive dropdown that offers clear options:

  • "On page load" - Runs when page loads or manually triggered
  • "Manual" - Runs only when explicitly called

The implementation is consistent across all plugin configurations and includes helpful subtexts that explain each option's behavior.

Also applies to: 7035-7053, 7115-7133, 7159-7177

app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java (3)

5-5: Import added correctly for RunBehaviorEnum.

The new import is properly added to support the new endpoint.


119-127: Well-implemented new endpoint for setting run behavior.

The new endpoint follows REST principles and controller patterns established in the codebase. The implementation includes proper logging and response formatting.


129-132: Good deprecation documentation for the legacy endpoint.

The Javadoc comment clearly indicates that the endpoint is deprecated and directs users to the new replacement endpoint.

app/client/src/ce/reducers/entityReducers/actionsReducer.tsx (2)

16-16: Correctly imported ActionRunBehaviourType type.

The import for the new type is properly added to support the updated action handler.


314-332: Updated action handler to use runBehavior instead of executeOnLoad.

The Redux action handler has been appropriately updated to use the new runBehavior property, maintaining consistent state update patterns with the rest of the reducer.

app/client/src/components/formControls/DropDownControl.tsx (5)

23-23: Added Flex and Text components import.

The import statement has been correctly updated to include the necessary components for the new styled components.


32-32: Added styled-components import.

The import for styled-components is correctly added to support the new styled components.


34-43: Created styled components for dropdown option formatting.

Two new styled components (OptionLabel and OptionSubText) have been added to properly format dropdown options with labels and subtexts, improving the user experience.


477-477: Fixed dropdown list height.

A consistent height of 240px is now applied to dropdown lists for better user experience and UI consistency.


511-540: Enhanced renderOptionWithIcon to support option subtexts.

The function now conditionally renders options with a more sophisticated layout when subtexts are provided, improving readability and information hierarchy in dropdowns.

app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json (2)

86-86: Updated action configuration to use runBehavior instead of executeOnLoad.

The action configuration now correctly uses the runBehavior property with the value "MANUAL" instead of the deprecated boolean executeOnLoad flag.


2546-2561: Replaced boolean toggle with descriptive dropdown for all plugin configurations.

The UI control for execution behavior has been consistently updated across all plugin configurations to use a dropdown with descriptive options instead of a simple toggle. The added subtexts provide clear explanations of each option's behavior.

app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json (2)

85-85: Correctly added runBehavior property with MANUAL default value.

The new runBehavior property has been properly added with the default value of "MANUAL" to replace the previous executeOnLoad boolean flag, aligning with the backend changes.


2545-2607: Config changes properly implement the run behavior dropdown UI.

The setting configuration has been properly updated to replace the previous boolean executeOnLoad switch with a more expressive dropdown for run behavior, including appropriate labels and descriptive subtext for both options.

app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx (5)

2-20: Correctly updated imports for new Select component.

The imports have been properly updated to include the necessary components for the dropdown implementation, including Select, Option, and styled component utilities.


21-34: Well-structured styled components for dropdown options.

The styled components are appropriately defined with proper naming and styling that matches the design system with correct color variables.


47-50: Successfully migrated from boolean to enum state.

The component state has been properly updated to use the runBehavior enum instead of the executeOnLoad boolean, with correct options handling.


51-66: Update handler correctly manages the new run behavior state.

The callback function correctly handles the new runBehavior enum, updates local state, calls the parent callback, and logs analytics with the appropriate properties.


69-106: UI successfully migrated from switch to dropdown.

The UI has been properly updated to use a Select component instead of a switch, with good layout, correct data-testid attributes, and appropriate rendering of options with labels and subtext.

app/client/src/actions/pluginActionActions.ts (3)

23-23: Correctly imported ActionRunBehaviourType.

The new type import for ActionRunBehaviourType has been correctly added to properly type the action payloads.


355-366: Successfully renamed action creator and updated payload type.

The action creator has been properly renamed from setActionsToExecuteOnLoad to setActionsRunBehavior, with the payload properly updated to use runBehavior instead of executeOnLoad.


368-380: Successfully renamed JS action creator and updated payload type.

The JS action creator has been properly renamed from setJSActionsToExecuteOnPageLoad to setJSActionsRunBehavior, with the payload correctly updated to use runBehavior instead of executeOnLoad.

app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java (4)

9-9: Correctly imported RunBehaviorEnum.

The RunBehaviorEnum has been properly imported for use in the service implementation.


304-310: Added bidirectional synchronization for backward compatibility.

The setExecuteOnLoad method has been correctly updated to also set the corresponding runBehavior value, ensuring backward compatibility for existing code.


322-349: Well-implemented new setRunBehavior method.

The new setRunBehavior method properly handles setting the new enum value while also maintaining backward compatibility by updating the executeOnLoad boolean flag.


426-435: Properly handled initialization of runBehavior in createAction.

The createAction method now correctly initializes the runBehavior property based on the execution context and existing executeOnLoad value, ensuring consistency between the two properties.

app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java (3)

11-11: Import added for RunBehaviorEnum

Good addition of the import for RunBehaviorEnum, which is needed for the new test cases below.


1357-1402: Test coverage for RunBehavior functionality looks good

The test method effectively verifies that when runBehavior is changed:

  1. Changing to ON_PAGE_LOAD updates both executeOnLoad and userSetOnLoad to true
  2. Changing back to MANUAL updates executeOnLoad to false while preserving userSetOnLoad
  3. Changes are properly persisted in the repository

The test structure is clean with appropriate assertions verifying the state transitions.


1404-1441: Good bidirectional sync test

This test properly verifies the backward compatibility of the system - ensuring that setting executeOnLoad (the legacy property) still correctly updates runBehavior (the new property).

The test covers both directions:

  1. executeOnLoad=true → runBehavior=ON_PAGE_LOAD
  2. executeOnLoad=false → runBehavior=MANUAL

This is critical for ensuring the consistency of the new model with existing code.

app/client/src/sagas/JSPaneSagas.ts (4)

104-104: Import added for ActionRunBehaviourType

The import for ActionRunBehaviourType is correctly added to support the changes in this file.


786-797: Updated setFunctionPropertySaga to handle runBehavior

The property check has been properly updated from "executeOnLoad" to "runBehavior" and now dispatches the appropriate action type. The payload structure has also been updated to include runBehavior instead of shouldExecute.


850-882: Renamed and updated saga for handling run behavior

The function has been appropriately renamed from toggleFunctionExecuteOnLoadSaga to updateFunctionRunBehaviorSaga. The implementation has been updated to:

  1. Accept runBehavior as a parameter instead of shouldExecute
  2. Call ActionAPI.updateActionRunBehavior instead of toggleActionExecuteOnLoad
  3. Update the redux action types for success and error states

The changes maintain the same error handling pattern.


947-948: Updated watcher saga to listen for new action type

The watcher saga has been updated to listen for UPDATE_FUNCTION_RUN_BEHAVIOR_INIT instead of TOGGLE_FUNCTION_EXECUTE_ON_LOAD_INIT, correctly connecting to the renamed saga handler.

app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx (3)

11-11: Import added for ActionRunBehaviourType

The import for ActionRunBehaviourType is correctly added to provide type safety for the runBehavior property.


364-392: Updated reducer handler for run behavior updates

The reducer handler has been properly updated to:

  1. Handle UPDATE_FUNCTION_RUN_BEHAVIOR_SUCCESS instead of TOGGLE_FUNCTION_EXECUTE_ON_LOAD_SUCCESS
  2. Accept runBehavior in the payload instead of executeOnLoad
  3. Set the runBehavior property on the action instead of executeOnLoad

This keeps the state updates aligned with the new model.


393-420: Updated reducer handler for setting run behavior

This handler has been appropriately updated to:

  1. Handle SET_JS_ACTION_RUN_BEHAVIOR instead of SET_JS_ACTION_TO_EXECUTE_ON_PAGELOAD
  2. Update runBehavior instead of executeOnLoad in the action objects
  3. Maintain the same efficient implementation using create() from mutative

The type in the payload has been properly updated to use ActionRunBehaviourType.

app/client/src/sagas/ActionSagas.ts (4)

150-150: Import added for ActionRunBehaviourType

The import for ActionRunBehaviourType is correctly added to provide type safety for the runBehavior property.


1042-1052: Updated setActionPropertySaga to handle runBehavior

The property check has been properly updated from "executeOnLoad" to "runBehavior" and now dispatches UPDATE_ACTION_RUN_BEHAVIOR_INIT with the appropriate payload structure.

The type casting to ActionRunBehaviourType provides good type safety.


1064-1089: Renamed and updated saga for handling run behavior

The function has been appropriately renamed from toggleActionExecuteOnLoadSaga to updateActionRunBehaviorSaga. The implementation has been updated to:

  1. Accept runBehavior as a parameter instead of shouldExecute
  2. Call ActionAPI.updateActionRunBehavior instead of toggleActionExecuteOnLoad
  3. Update the redux action types for success and error states

The changes maintain the same error handling pattern and keep the behavior consistent.


1269-1270: Updated watcher saga to listen for new action type

The watcher saga has been updated to listen for UPDATE_ACTION_RUN_BEHAVIOR_INIT instead of TOGGLE_ACTION_EXECUTE_ON_LOAD_INIT, correctly connecting to the renamed saga handler.

app/client/src/ce/constants/ReduxActionConstants.tsx (4)

69-69: Appropriate addition of JS action run behavior constants.

The new constants properly support the migration from boolean executeOnLoad to the more expressive runBehavior enum pattern.

Also applies to: 71-72


87-87: Added corresponding error type for function run behavior.

Good practice to include the error constant to maintain consistency with the rest of the codebase's error handling patterns.


808-810: Appropriate addition of action run behavior constants.

These constants properly implement the transition from executeOnLoad boolean flag to the more flexible runBehavior pattern for regular actions.


824-824: Added corresponding error type for action run behavior.

Maintains error handling consistency throughout the codebase.

@ankitakinger ankitakinger changed the base branch from release to feat/reactive-actions-run-behaviour April 29, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Core Query Execution Issues related to the execution of all queries IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Integrations Product Issues related to a specific integration potential-duplicate This label marks issues that are potential duplicates of already open issues Query Settings Issues related to the settings of all queries Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Fix any cypress or unit test cases that fail with update of references
2 participants