Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
.markdown {
color: var(--color-fg);

&::after,
Comment thread
riodeuno marked this conversation as resolved.
&::before {
/* This is required to remove the compensators of capsizing that comes up due to use of `wds-body-text` class */
content: none !important;
}

table {
border: var(--border-width-1) solid var(--color-bd);
border-collapse: separate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { addNewAnvilWidgetToDSL } from "layoutSystems/anvil/integrations/sagas/a
export function* createSectionAndAddWidget(
allWidgets: CanvasWidgetsReduxState,
highlight: AnvilHighlightInfo,
widgets: WidgetLayoutProps[],
draggedWidgets: WidgetLayoutProps[],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

used better contextual name to avoid confusion.
widgets felt like it is all the widgets but it is only the dragged widgets.

parentId: string,
) {
/**
Expand Down Expand Up @@ -48,7 +48,7 @@ export function* createSectionAndAddWidget(
yield call(
addWidgetsToSection,
updatedWidgets,
widgets,
draggedWidgets,
highlight,
sectionProps,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function* createZoneAndAddWidgets(
updatedWidgets,
draggedWidgets,
highlight,
zoneProps,
zoneProps.widgetId,
);

return res;
Expand All @@ -68,13 +68,11 @@ export function* addWidgetsToZone(
allWidgets: CanvasWidgetsReduxState,
draggedWidgets: WidgetLayoutProps[],
highlight: AnvilHighlightInfo,
zone: WidgetProps,
zoneWidgetId: string,
) {
let updatedWidgets: CanvasWidgetsReduxState = { ...allWidgets };
const zoneProps = { ...zone };
const preset: LayoutProps[] = zoneProps.layout;
const preset: LayoutProps[] = updatedWidgets[zoneWidgetId].layout;
let zoneLayout: LayoutProps = preset[0];
const { widgetId: zoneWidgetId } = zoneProps;

/**
* If dragged widget is a new widget,
Expand All @@ -86,7 +84,7 @@ export function* addWidgetsToZone(
zoneWidgetId,
draggedWidgets,
);
zoneProps.children = updatedWidgets[zoneWidgetId].children;
updatedWidgets[zoneWidgetId].children = updatedWidgets[zoneWidgetId].children;
Comment thread
jsartisan marked this conversation as resolved.
Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the updateDraggedWidgets can update the zone in the blueprint operation as well, but we didn't use updatedWidgets's zone. We just worked on the zone that we got in params.
This is the source of inconsistency.


/**
* Split new widgets based on type.
Expand Down Expand Up @@ -127,14 +125,11 @@ export function* addWidgetsToZone(
/**
* Update zone widget with the updated preset.
*/
zoneProps.layout = [zoneLayout];
updatedWidgets[zoneWidgetId].layout = [zoneLayout];

return {
canvasWidgets: {
...updatedWidgets,
[zoneProps.widgetId]: zoneProps,
},
zone: zoneProps,
canvasWidgets: updatedWidgets,
zone: updatedWidgets[zoneWidgetId],
};
}

Expand Down Expand Up @@ -219,7 +214,7 @@ function* moveWidgetsToNewLayout(
widgets,
transformMovedWidgets(widgets, movedWidgets, highlight),
highlight,
zone,
zone.widgetId,
);

return canvasWidgets;
Expand Down
6 changes: 4 additions & 2 deletions app/client/src/sagas/WidgetBlueprintSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ export function* executeWidgetBlueprintOperations(

updatePropertyPayloads &&
updatePropertyPayloads.forEach((params: UpdatePropertyArgs) => {
widgets[params.widgetId][params.propertyName] =
params.propertyValue;
widgets[params.widgetId] = {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For cases where widgets are already present in redux, the objects are frozen and the fields are readonly. So we couldn't update them. used the spread operator to bypass that. Hoping this won't cause any issue.

...widgets[params.widgetId],
[params.propertyName]: params.propertyValue,
};
});
break;
}
Expand Down