Skip to content

Commit fac4dfa

Browse files
rootroot
authored andcommitted
Merge branch 'feature/widget-grouping-3-container' of github.com:appsmithorg/appsmith into feature/widget-grouping-3-container
2 parents edb1daf + a157df6 commit fac4dfa

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

app/client/src/sagas/WidgetOperationSagas.tsx

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,14 @@ function* pasteWidgetSaga(action: ReduxAction<{ groupWidgets: boolean }>) {
15281528
for (let i = 0; i < newWidgetList.length; i++) {
15291529
const widget = newWidgetList[i];
15301530
const oldWidgetName = widget.widgetName;
1531+
let newWidgetName = oldWidgetName;
1532+
1533+
if (!shouldGroup) {
1534+
newWidgetName = getNextWidgetName(widgets, widget.type, evalTree, {
1535+
prefix: oldWidgetName,
1536+
startWithoutIndex: true,
1537+
});
1538+
}
15311539

15321540
// Update the children widgetIds if it has children
15331541
if (widget.children && widget.children.length > 0) {
@@ -1557,12 +1565,6 @@ function* pasteWidgetSaga(action: ReduxAction<{ groupWidgets: boolean }>) {
15571565
// Update the table widget column properties
15581566
if (widget.type === WidgetTypes.TABLE_WIDGET) {
15591567
try {
1560-
const oldWidgetName = widget.widgetName;
1561-
const newWidgetName = getNextWidgetName(
1562-
widgets,
1563-
widget.type,
1564-
evalTree,
1565-
);
15661568
// If the primaryColumns of the table exist
15671569
if (widget.primaryColumns) {
15681570
// For each column
@@ -1657,15 +1659,7 @@ function* pasteWidgetSaga(action: ReduxAction<{ groupWidgets: boolean }>) {
16571659
}
16581660
// Generate a new unique widget name
16591661
if (!shouldGroup) {
1660-
widget.widgetName = getNextWidgetName(
1661-
widgets,
1662-
widget.type,
1663-
evalTree,
1664-
{
1665-
prefix: oldWidgetName,
1666-
startWithoutIndex: true,
1667-
},
1668-
);
1662+
widget.widgetName = newWidgetName;
16691663
}
16701664

16711665
widgetNameMap[oldWidgetName] = widget.widgetName;

0 commit comments

Comments
 (0)