Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -9,6 +9,10 @@ import type { SelectOptionProps } from "@appsmith/ads";
import type { ReduxAction } from "actions/ReduxActionTypes";
import { PluginType } from "entities/Plugin";

jest.mock("ee/selectors/featureFlagsSelectors", () => ({
selectFeatureFlags: jest.fn(() => {}),
}));

const mockStore = configureStore([]);

const initialValues = {
Expand Down
16 changes: 16 additions & 0 deletions app/client/src/components/formControls/DropDownControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import type {
} from "reducers/evaluationReducers/formEvaluationReducer";
import NoSearchCommandFound from "./CustomActionsConfigControl/NoSearchCommandFound";
import styled from "styled-components";
import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes";
import type { FeatureFlags } from "ee/entities/FeatureFlag";
import { selectFeatureFlags } from "ee/selectors/featureFlagsSelectors";

const OptionLabel = styled(Text)`
color: var(--ads-v2-color-fg);
Expand Down Expand Up @@ -139,6 +142,7 @@ export interface DropDownControlProps extends ControlProps {
pluginId: string;
identifier: string;
};
featureFlags?: FeatureFlags;
}

interface ReduxDispatchProps {
Expand Down Expand Up @@ -298,6 +302,15 @@ function renderDropdown(
selectedValue = uniqBy(selectedValue, (v) => v);
}

/* temporary check added to switch from automatic to page load as the run behaviour when feature flag is turned off */
if (
selectedValue === ActionRunBehaviour.AUTOMATIC &&
input?.name === "runBehaviour" &&
!props.featureFlags?.release_reactive_actions_enabled
) {
selectedValue = ActionRunBehaviour.ON_PAGE_LOAD;
}

// Use memoized grouping
const groupedOptions = memoizedBuildGroupedOptions(
options,
Expand Down Expand Up @@ -558,11 +571,13 @@ const mapStateToProps = (
pluginId: string;
identifier: string;
};
featureFlags: FeatureFlags;
} => {
let isLoading = false;
// Start with the user-provided options if not fetching conditionally
let options = ownProps.fetchOptionsConditionally ? [] : ownProps.options;
const formValues: Partial<Action> = getFormValues(ownProps.formName)(state);
const featureFlags = selectFeatureFlags(state);

let nextPageNeeded = false;
let paginationPayload;
Expand Down Expand Up @@ -631,6 +646,7 @@ const mapStateToProps = (
formValues,
nextPageNeeded,
paginationPayload,
featureFlags,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,24 @@ interface FunctionSettingsRowProps extends Omit<Props, "actions"> {

const FunctionSettingRow = (props: FunctionSettingsRowProps) => {
const [runBehaviour, setRunBehaviour] = useState(props.action.runBehaviour);
const flagValueForReactiveActions = useFeatureFlag(
const isReactiveActionsEnabled = useFeatureFlag(
FEATURE_FLAG.release_reactive_actions_enabled,
);
const options = RUN_BEHAVIOR_VALUES.filter(
(option) =>
flagValueForReactiveActions ||
option.value !== ActionRunBehaviour.AUTOMATIC,
isReactiveActionsEnabled || option.value !== ActionRunBehaviour.AUTOMATIC,
) as SelectOptionProps[];
const selectedValue = options.find((opt) => opt.value === runBehaviour);
let selectedValue = options.find((opt) => opt.value === runBehaviour);

/* temporary check added to switch from automatic to page load as the run behaviour when feature flag is turned off */
if (
runBehaviour === ActionRunBehaviour.AUTOMATIC &&
!isReactiveActionsEnabled
) {
selectedValue = options.find(
(opt) => opt.value === ActionRunBehaviour.ON_PAGE_LOAD,
);
}

const onSelectOptions = useCallback(
(newRunBehaviour: ActionRunBehaviourType) => {
Expand Down
Loading