Skip to content

Commit

Permalink
Merge branch 'release' of github.com:appsmithorg/appsmith into fix/ax…
Browse files Browse the repository at this point in the history
…ios-branding-bug
  • Loading branch information
jsartisan committed Nov 28, 2023
2 parents bead90f + a9c47a0 commit f2f43c0
Show file tree
Hide file tree
Showing 39 changed files with 220 additions and 706 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rts-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ defaults:

jobs:
build:
runs-on: appsmith-self-hosted-deployment-runner
runs-on: ubuntu-latest
# Only run this workflow for internally triggered events
if: |
github.event.pull_request.head.repo.full_name == github.repository ||
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import {
agHelper,
locators,
entityExplorer,
jsEditor,
} from "../../../../support/Objects/ObjectsCore";
import { EntityItems } from "../../../../support/Pages/AssertHelper";

const jsObjectBody = `export default {
myVar1: [],
myVar2: {},
myFun1(){
},
myFun2: async () => {
//use async-await or promises
}
}`;

describe("Verifies JS object rename bug", () => {
it("Verify that a JS Object name is up for taking after it is deleted", () => {
jsEditor.CreateJSObject(jsObjectBody, {
paste: true,
completeReplace: true,
toRun: false,
shouldCreateNewJSObj: true,
prettify: false,
});

jsEditor.CreateJSObject(jsObjectBody, {
paste: true,
completeReplace: true,
toRun: false,
shouldCreateNewJSObj: true,
prettify: false,
});

jsEditor.RenameJSObjFromPane("JSObj2");

agHelper.ActionContextMenuWithInPane({
action: "Delete",
entityType: EntityItems.JSObject,
});

jsEditor.CreateJSObject(jsObjectBody, {
paste: true,
completeReplace: true,
toRun: false,
shouldCreateNewJSObj: true,
prettify: false,
});

jsEditor.RenameJSObjFromPane("JSObj2");

entityExplorer.AssertEntityPresenceInExplorer("JSObj2");
});
});
20 changes: 10 additions & 10 deletions app/client/src/ce/sagas/JSActionSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,19 +377,19 @@ export function* refactorJSObjectName(
getJSCollection(state, id),
);
const functions = jsObject.actions;
yield put(
updateActionData(
functions.map((f) => ({
entityName: newName,
data: undefined,
dataPath: `${f.name}.data`,
dataPathRef: `${oldName}.${f.name}.data`,
})),
),
);
if (currentPageId === pageId) {
// @ts-expect-error: refactorResponse.data is of type unknown
yield updateCanvasWithDSL(refactorResponse.data, pageId, layoutId);
yield put(
updateActionData(
functions.map((f) => ({
entityName: newName,
data: undefined,
dataPath: `${f.name}.data`,
dataPathRef: `${oldName}.${f.name}.data`,
})),
),
);
} else {
yield put(fetchJSCollectionsForPage(pageId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ const ActionCreator = React.forwardRef(
<div className="flex flex-col gap-[2px]" ref={ref}>
{Object.entries(actions).map(([id, value], index) => (
<Action
additionalAutoComplete={props.additionalAutoComplete}
code={value}
dataTreePath={props.dataTreePath}
id={id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { getCodeFromMoustache, getSelectedFieldFromValue } from "../../utils";

export default function ActionSelector(props: {
action: TActionBlock;
additionalAutoComplete?: AdditionalDynamicDataTree;
children: React.ReactNode;
open: boolean;
id: string;
Expand Down Expand Up @@ -47,6 +48,7 @@ export default function ActionSelector(props: {
content={
<ActionSelectorForm
action={action}
additionalAutoComplete={props.additionalAutoComplete}
dataTreePath={props.dataTreePath}
onChange={props.onChange}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ActionSelector from "./ActionSelector";
import AnalyticsUtil from "utils/AnalyticsUtil";
import { getActionTypeLabel } from "../ActionBlockTree/utils";
import classNames from "classnames";
import type { AdditionalDynamicDataTree } from "utils/autocomplete/customTreeTypeDefCreator";

const CallbackBlockContainer = styled.div<{
isSelected: boolean;
Expand Down Expand Up @@ -44,6 +45,7 @@ const EMPTY_ACTION_BLOCK: TActionBlock = {

export default function ActionTree(props: {
actionBlock: TActionBlock;
additionalAutoComplete?: AdditionalDynamicDataTree;
onChange: (actionBlock: TActionBlock) => void;
className?: string;
id: string;
Expand Down Expand Up @@ -176,6 +178,7 @@ export default function ActionTree(props: {
<div className={props.className}>
<ActionSelector
action={actionBlock}
additionalAutoComplete={props.additionalAutoComplete}
dataTreePath={props.dataTreePath}
id={id}
level={props.level}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ActionTree from "./ActionTree";
import { useApisQueriesAndJsActionOptions } from "../../helpers";
import type { TActionBlock } from "../../types";
import { actionToCode, codeToAction } from "../../utils";
import type { AdditionalDynamicDataTree } from "utils/autocomplete/customTreeTypeDefCreator";

interface TRootActionProps {
code: string;
Expand All @@ -13,6 +14,7 @@ interface TRootActionProps {
widgetName: string;
widgetType: string;
dataTreePath: string | undefined;
additionalAutoComplete?: AdditionalDynamicDataTree;
}

export default function Action(props: TRootActionProps) {
Expand Down Expand Up @@ -41,6 +43,7 @@ export default function Action(props: TRootActionProps) {
return (
<ActionTree
actionBlock={action}
additionalAutoComplete={props.additionalAutoComplete}
className={`${props.index === 0 ? "mt-1" : "mt-2"}`}
dataTreePath={props.dataTreePath}
id={id}
Expand Down
Loading

0 comments on commit f2f43c0

Please sign in to comment.