Skip to content

Commit

Permalink
fix(copy-paste): fix varRefs when copy-pasting across different compo…
Browse files Browse the repository at this point in the history
…nents

GitOrigin-RevId: 0f044b16abb7ddc94bc9258332bb125d7adadbf4
  • Loading branch information
IcaroG authored and actions-user committed Oct 25, 2024
1 parent 1c67f58 commit 27417c8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions platform/wab/src/wab/client/components/canvas/view-ops.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2626,6 +2626,14 @@ export class ViewOps {
});
}
}
// Remove all VarRefs that do not exist in the current context.
const componentVars = new Set(component.params.map((p) => p.variable));
const varRefs = Array.from(Components.findVarRefs(newItem));
varRefs.forEach((varRef) => {
if (!componentVars.has(varRef.var) && varRef.arg) {
common.removeWhere(varRef.vs.args, (arg) => arg === varRef.arg);
}
});

// If this newItem is being pasted into a non-base context, then set the base variant setting
// to invisible, just as we do when drawing a new node in a non-base context.
Expand Down

0 comments on commit 27417c8

Please sign in to comment.