Skip to content
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

fix: resolve redundant JSObject action saving #36958

Merged
merged 6 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions app/client/src/ce/entities/DataTree/dataTreeJSAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export const generateDataTreeJSAction = (
for (let i = 0; i < actions.length; i++) {
const action = actions[i];

// If action already exists, skip adding it to the data tree
if (actionsData[action.name]) continue;

meta[action.name] = {
arguments: action.actionConfiguration?.jsArguments || [],
confirmBeforeExecute: !!action.confirmBeforeExecute,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ public Mono<ActionCollectionDTO> updateUnpublishedActionCollection(

final Mono<Map<String, String>> newValidActionIdsMono = branchedActionCollectionMono.flatMap(
branchedActionCollection -> Flux.fromIterable(actionCollectionDTO.getActions())
.distinct(actionDTO -> actionCollectionDTO.getName() + "." + actionDTO.getName())
.flatMap(actionDTO -> {
actionDTO.setDeletedAt(null);
setContextId(branchedActionCollection, actionDTO);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Simplify initialization of baseActionIds

You create a new HashSet called baseActionIds and add all elements from validBaseActionIds. Since validBaseActionIds is already a set, you can use it directly or instantiate baseActionIds with new HashSet<>(validBaseActionIds) to simplify the code.

Expand Down
Loading