From e4c5e04ae1c20a85bfa5c4fcc5dfb60dd241c44a Mon Sep 17 00:00:00 2001 From: Balint Gabor <127662+gbalint@users.noreply.github.com> Date: Fri, 18 Oct 2024 09:30:50 +0200 Subject: [PATCH] Update gap when rowGap or columnGap is not specified (#6561) **Problem:** When no separate rowGap or columnGap property is specified, the gap control should update the gap property. **Fix:** Check it in the strategy if a rowGap or columnGap exists, and if not, update the gap property **Manual Tests:** I hereby swear that: - [x] I opened a hydrogen project and it loaded - [x] I could navigate to various routes in Play mode --- .../strategies/set-grid-gap-strategy.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/editor/src/components/canvas/canvas-strategies/strategies/set-grid-gap-strategy.tsx b/editor/src/components/canvas/canvas-strategies/strategies/set-grid-gap-strategy.tsx index 9339b388a790..efcba9317cb9 100644 --- a/editor/src/components/canvas/canvas-strategies/strategies/set-grid-gap-strategy.tsx +++ b/editor/src/components/canvas/canvas-strategies/strategies/set-grid-gap-strategy.tsx @@ -164,9 +164,17 @@ export const setGridGapStrategy: CanvasStrategyFactory = ( return emptyStrategyApplicationResult } + const shouldSetGapByAxis = gridGap.row.value != null || gridGap.column.value != null + const axis = interactionSession.activeControl.axis const shouldTearOffGapByAxis = axis === 'row' ? shouldTearOffGap.y : shouldTearOffGap.x - const axisStyleProp = axis === 'row' ? StyleRowGapProp : StyleColumnGapProp + + const axisStyleProp = shouldSetGapByAxis + ? axis === 'row' + ? StyleRowGapProp + : StyleColumnGapProp + : StyleGapProp + const gridGapMeasurement = axis === 'row' ? updatedGridGapMeasurement.row : updatedGridGapMeasurement.column