Skip to content

feat: Replacing execute on load toggle with run behaviour in all actions / jsactions #40355

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
merged 28 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a9803cf
feat: Migrate executeOnLoad to runBehavior enum
ankitakinger Apr 22, 2025
acccb98
Merge pull request #40347 from appsmithorg/feat/replace-executeOnLoad…
vivek-appsmith Apr 23, 2025
3858d4d
feat: Replacing `executeOnLoad` with `runBehavior` in all action conf…
ankitakinger Apr 23, 2025
606b940
feat: Replacing remaining instances of `executeOnLoad` with `runBehav…
ankitakinger Apr 24, 2025
17bb150
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Apr 24, 2025
f61747a
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Apr 25, 2025
eff5699
chore: Update type for run behavior for some instances (#40393)
ankitakinger Apr 25, 2025
19605a6
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Apr 29, 2025
3867bcf
fix: Updating JSFunctionSettings unit test to fix failure (#40480)
ankitakinger Apr 29, 2025
d1af0b8
fix: Cyclic dependencies for reactive queries run behavior changes (#…
ankitakinger Apr 30, 2025
fd15967
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Apr 30, 2025
0c8bd0b
Merge branch 'feat/reactive-actions-run-behaviour' of https://github.…
ankitakinger Apr 30, 2025
62ccf03
ci: Fixing cypress tests that are failing due to the change from exec…
ankitakinger Apr 30, 2025
c5d2f5d
ci: Fixing remaining 4 failing cypress test cases (#40515)
ankitakinger Apr 30, 2025
bc2dcec
chore: Updating the spelling for `runBehaviour` (#40490)
ankitakinger May 2, 2025
fbaadc2
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger May 2, 2025
fb3aa4b
Merge branch 'feat/reactive-actions-run-behaviour' of https://github.…
ankitakinger May 2, 2025
0c74aee
ci: Updating fixtures to replace executeOnLoad with reactiveActions (…
ankitakinger May 2, 2025
5856863
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger May 7, 2025
1796b9d
Merge branch 'feat/reactive-actions-run-behaviour' of https://github.…
ankitakinger May 7, 2025
2e29675
Merge branch 'release' into feat/reactive-actions-run-behaviour
May 7, 2025
a46ef1c
Merge branch 'feat/reactive-actions-run-behaviour' of https://github.…
ankitakinger May 7, 2025
fa5b583
Merge branch 'release' into feat/reactive-actions-run-behaviour
May 7, 2025
ee2aeca
Merge branch 'feat/reactive-actions-run-behaviour' of https://github.…
ankitakinger May 8, 2025
d0a1e83
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger May 8, 2025
bf058d0
ci: Fixing partial export spec (#40611)
ankitakinger May 8, 2025
f34a597
feat: Updated references of all executeOnLoad to runBehaviour (#40361)
sneha122 May 8, 2025
7cd7438
feat: execute on load backwards compatibility backend changes (#40644)
sneha122 May 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";

export const THEME = EditorTheme.LIGHT;

export enum ActionRunBehaviour {
PAGE_LOAD = "PAGE_LOAD",
MANUAL = "MANUAL",
}

export const RUN_BEHAVIOR = {
PAGE_LOAD: {
label: "On page load",
subText: "Query runs when the page loads or when manually triggered",
value: ActionRunBehaviour.PAGE_LOAD,
},
MANUAL: {
label: "Manual",
subText: "Query only runs when called in an event or JS with .run()",
value: ActionRunBehaviour.MANUAL,
},
};

export const RUN_BEHAVIOR_VALUES = Object.values(RUN_BEHAVIOR);
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import {
MultiPartOptionTypes,
POST_BODY_FORMAT_OPTIONS,
} from "../constants/CommonApiConstants";
import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants";

// jest.mock("POST_");

const BASE_ACTION: ApiAction = {
dynamicBindingPathList: [],
cacheResponse: "",
executeOnLoad: false,
runBehavior: ActionRunBehaviour.MANUAL,
invalids: [],
isValid: false,
workspaceId: "",
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/ce/constants/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2583,7 +2583,7 @@ export const PREPARED_STATEMENT_WARNING = {

export const JS_EDITOR_SETTINGS = {
TITLE: () => "Settings",
ON_LOAD_TITLE: () => "Choose the functions to run on page load",
ON_LOAD_TITLE: () => "Choose functions run behavior",
};

export const CUSTOM_WIDGET_BUILDER_TAB_TITLE = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,7 @@ export const defaultAppState = {
],
},
executeOnLoad: true,
runBehavior: "PAGE_LOAD",
dynamicBindingPathList: [],
isValid: true,
invalids: [],
Expand Down Expand Up @@ -2392,6 +2393,7 @@ export const defaultAppState = {
},
},
executeOnLoad: false,
runBehavior: "MANUAL",
isValid: true,
invalids: [],
messages: [],
Expand Down Expand Up @@ -10038,9 +10040,24 @@ export const defaultAppState = {
id: 1,
children: [
{
label: "Run the query on page load",
configProperty: "executeOnLoad",
controlType: "SWITCH",
label: "Run behavior",
configProperty: "runBehavior",
controlType: "DROP_DOWN",
initialValue: "MANUAL",
options: [
{
label: "On page load",
subText:
"Query runs when the page loads or when manually triggered",
value: "PAGE_LOAD",
},
{
label: "Manual",
subText:
"Query only runs when called in an event or JS with .run()",
value: "MANUAL",
},
],
},
{
label: "Request confirmation before running this query",
Expand Down Expand Up @@ -10074,9 +10091,24 @@ export const defaultAppState = {
id: 1,
children: [
{
label: "Run the query on page load",
configProperty: "executeOnLoad",
controlType: "SWITCH",
label: "Run behavior",
configProperty: "runBehavior",
controlType: "DROP_DOWN",
initialValue: "MANUAL",
options: [
{
label: "On page load",
subText:
"Query runs when the page loads or when manually triggered",
value: "PAGE_LOAD",
},
{
label: "Manual",
subText:
"Query only runs when called in an event or JS with .run()",
value: "MANUAL",
},
],
},
{
label: "Request confirmation before running this query",
Expand Down Expand Up @@ -10110,9 +10142,24 @@ export const defaultAppState = {
id: 1,
children: [
{
label: "Run the API on page load",
configProperty: "executeOnLoad",
controlType: "SWITCH",
label: "Run behavior",
configProperty: "runBehavior",
controlType: "DROP_DOWN",
initialValue: "MANUAL",
options: [
{
label: "On page load",
subText:
"Query runs when the page loads or when manually triggered",
value: "PAGE_LOAD",
},
{
label: "Manual",
subText:
"Query only runs when called in an event or JS with .run()",
value: "MANUAL",
},
],
},
{
label: "Request confirmation before running this API",
Expand Down Expand Up @@ -10175,9 +10222,24 @@ export const defaultAppState = {
id: 1,
children: [
{
label: "Run the API on page load",
configProperty: "executeOnLoad",
controlType: "SWITCH",
label: "Run behavior",
configProperty: "runBehavior",
controlType: "DROP_DOWN",
initialValue: "MANUAL",
options: [
{
label: "On page load",
subText:
"Query runs when the page loads or when manually triggered",
value: "PAGE_LOAD",
},
{
label: "Manual",
subText:
"Query only runs when called in an event or JS with .run()",
value: "MANUAL",
},
],
},
{
label: "Request confirmation before running this API",
Expand Down Expand Up @@ -10353,6 +10415,7 @@ export const defaultAppState = {
jsArguments: [],
},
executeOnLoad: false,
runBehavior: "MANUAL",
clientSideExecution: true,
dynamicBindingPathList: [
{
Expand Down Expand Up @@ -10403,6 +10466,7 @@ export const defaultAppState = {
jsArguments: [],
},
executeOnLoad: false,
runBehavior: "MANUAL",
clientSideExecution: true,
dynamicBindingPathList: [
{
Expand Down Expand Up @@ -10487,6 +10551,7 @@ export const defaultAppState = {
jsArguments: [],
},
executeOnLoad: false,
runBehavior: "MANUAL",
clientSideExecution: true,
dynamicBindingPathList: [
{
Expand Down Expand Up @@ -10537,6 +10602,7 @@ export const defaultAppState = {
jsArguments: [],
},
executeOnLoad: false,
runBehavior: "MANUAL",
clientSideExecution: true,
dynamicBindingPathList: [
{
Expand Down
34 changes: 32 additions & 2 deletions app/client/src/components/formControls/DropDownControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from "workers/Evaluation/formEval";
import type { Action } from "entities/Action";
import type { SelectOptionProps } from "@appsmith/ads";
import { Icon, Option, OptGroup, Select } from "@appsmith/ads";
import { Icon, Option, OptGroup, Select, Flex, Text } from "@appsmith/ads";
import { getFormConfigConditionalOutput } from "selectors/formSelectors";
import { fetchFormDynamicValNextPage } from "actions/evaluationActions";
import { objectKeys } from "@appsmith/utils";
Expand All @@ -29,6 +29,18 @@ import type {
DynamicValues,
} from "reducers/evaluationReducers/formEvaluationReducer";
import NoSearchCommandFound from "./CustomActionsConfigControl/NoSearchCommandFound";
import styled from "styled-components";

const OptionLabel = styled(Text)`
color: var(--ads-v2-color-fg);
font-size: 14px;
font-weight: 500;
`;

const OptionSubText = styled(Text)`
color: var(--ads-v2-color-fg-muted);
font-size: 12px;
`;

export interface DropDownGroupedOptions {
label: string;
Expand Down Expand Up @@ -462,6 +474,7 @@ function renderDropdown(
isDisabled={props.disabled}
isLoading={props.isLoading}
isMultiSelect={isMultiSelect}
listHeight={240}
maxTagCount={props.maxTagCount}
notFoundContent={
<NoSearchCommandFound
Expand Down Expand Up @@ -495,7 +508,24 @@ function renderDropdown(
}

function renderOptionWithIcon(option: SelectOptionProps) {
return (
return option.subText ? (
<Option
aria-label={option.label}
disabled={option.disabled}
isDisabled={option.isDisabled}
key={option.value}
label={option.label}
value={option.value}
>
<Flex flexDirection="column">
<Flex>
{option.icon && <Icon color={option.color} name={option.icon} />}
<OptionLabel>{option.label}</OptionLabel>
</Flex>
<OptionSubText>{option.subText}</OptionSubText>
</Flex>
</Option>
) : (
<Option
aria-label={option.label}
disabled={option.disabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ import {
HTTP_PROTOCOL,
HTTP_PROTOCOL_VERSIONS,
} from "PluginActionEditor/constants/CommonApiConstants";
import {
RUN_BEHAVIOR,
RUN_BEHAVIOR_VALUES,
} from "PluginActionEditor/constants/PluginActionConstants";

export default [
{
sectionName: "",
id: 1,
children: [
{
label: "Run the API on page load",
configProperty: "executeOnLoad",
controlType: "SWITCH",
label: "Run behavior",
configProperty: "runBehavior",
controlType: "DROP_DOWN",
initialValue: RUN_BEHAVIOR.MANUAL.label,
options: RUN_BEHAVIOR_VALUES,
},
{
label: "Request confirmation before running this API",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import {
RUN_BEHAVIOR,
RUN_BEHAVIOR_VALUES,
} from "PluginActionEditor/constants/PluginActionConstants";

export default [
{
sectionName: "",
id: 1,
children: [
{
label: "Run the API on page load",
configProperty: "executeOnLoad",
controlType: "SWITCH",
label: "Run behavior",
configProperty: "runBehavior",
controlType: "DROP_DOWN",
initialValue: RUN_BEHAVIOR.MANUAL.label,
options: RUN_BEHAVIOR_VALUES,
},
{
label: "Request confirmation before running this API",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import {
RUN_BEHAVIOR,
RUN_BEHAVIOR_VALUES,
} from "PluginActionEditor/constants/PluginActionConstants";

export default [
{
sectionName: "",
id: 1,
children: [
{
label: "Run the query on page load",
configProperty: "executeOnLoad",
controlType: "SWITCH",
label: "Run behavior",
configProperty: "runBehavior",
controlType: "DROP_DOWN",
initialValue: RUN_BEHAVIOR.MANUAL.label,
options: RUN_BEHAVIOR_VALUES,
},
{
label: "Request confirmation before running this query",
Expand Down
2 changes: 2 additions & 0 deletions app/client/src/entities/Action/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
type Plugin,
type PluginName,
} from "../Plugin";
import type { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants";

export enum PaginationType {
NONE = "NONE",
Expand Down Expand Up @@ -140,6 +141,7 @@ export interface BaseAction {
collectionId?: string;
pluginId: string;
executeOnLoad: boolean;
runBehavior?: ActionRunBehaviour;
dynamicBindingPathList: DynamicPath[];
isValid: boolean;
invalids: string[];
Expand Down
Loading
Loading