Skip to content

Commit

Permalink
refactor: Separate types from implementations to reduce cyclic depend…
Browse files Browse the repository at this point in the history
…encies

- Move types to dedicated type files
- Update imports to reference new type locations
- Reduce cyclic dependencies to address memory issues

Testing: No functional changes

Co-Authored-By: arpit@appsmith.com <arpit@appsmith.com>
  • Loading branch information
devin-ai-integration[bot] and mohanarpit committed Jan 8, 2025
1 parent 8efce1d commit 40cc01e
Show file tree
Hide file tree
Showing 10 changed files with 473 additions and 360 deletions.
66 changes: 12 additions & 54 deletions app/client/src/actions/controlActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@ import type {
ReduxActionType,
} from "ee/constants/ReduxActionConstants";
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import type { UpdateWidgetsPayload } from "reducers/entityReducers/canvasWidgetsReducer";
import type { UpdateWidgetsPayload } from "reducers/types/canvasWidgets.types";
import type { DynamicPath } from "utils/DynamicBindingUtils";
import type {
BatchPropertyUpdatePayload,
UpdateWidgetPropertyRequestPayload,
UpdateWidgetPropertyPayload,
UpdateCanvasLayoutPayload,
SetWidgetDynamicPropertyPayload,
BatchUpdateDynamicPropertyUpdates,
BatchUpdateWidgetDynamicPropertyPayload,
DeleteWidgetPropertyPayload,
} from "./types/controlActions.types";

export const updateWidgetPropertyRequest = (
widgetId: string,
Expand All @@ -23,12 +33,7 @@ export const updateWidgetPropertyRequest = (
};
};

export interface BatchPropertyUpdatePayload {
modify?: Record<string, unknown>; //Key value pairs of paths and values to update
remove?: string[]; //Array of paths to delete
triggerPaths?: string[]; // Array of paths in the modify and remove list which are trigger paths
postUpdateAction?: ReduxActionType; // Array of action types we need to dispatch after property updates.
}


export const batchUpdateWidgetProperty = (
widgetId: string,
Expand Down Expand Up @@ -111,50 +116,3 @@ export const updateMultipleMetaWidgetPropertiesAction = (
payload: { widgetsToUpdate, shouldEval },
};
};

export interface UpdateWidgetPropertyRequestPayload {
widgetId: string;
propertyPath: string;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
propertyValue: any;
}

export interface UpdateWidgetPropertyPayload {
widgetId: string;
updates: BatchPropertyUpdatePayload;
dynamicUpdates?: {
dynamicBindingPathList?: DynamicPath[];
dynamicTriggerPathList?: DynamicPath[];
dynamicPropertyPathList?: DynamicPath[];
};
shouldReplay?: boolean;
}

export interface UpdateCanvasLayoutPayload {
width: number;
height: number;
}

export interface SetWidgetDynamicPropertyPayload {
widgetId: string;
propertyPath: string;
isDynamic: boolean;
shouldRejectDynamicBindingPathList?: boolean;
skipValidation?: boolean;
}

export type BatchUpdateDynamicPropertyUpdates = Omit<
SetWidgetDynamicPropertyPayload,
"widgetId"
>;

export interface BatchUpdateWidgetDynamicPropertyPayload {
widgetId: string;
updates: BatchUpdateDynamicPropertyUpdates[];
}

export interface DeleteWidgetPropertyPayload {
widgetId: string;
propertyPaths: string[];
}
Loading

0 comments on commit 40cc01e

Please sign in to comment.