Skip to content

Commit

Permalink
Specify elements to rerender in keyboard & gap strategies (#6446)
Browse files Browse the repository at this point in the history
## Problem
The keyboard font strategies and the gap setter strategies don't
correctly declare the elements to rerender in the strategy application
result

## Fix
Fill it in with the correct element path array
  • Loading branch information
bkrmendy authored Oct 2, 2024
1 parent b3a7b8e commit b8c8dcb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function keyboardSetFontSizeStrategy(
),
)

return strategyApplicationResult(commands, 'rerender-all-elements')
return strategyApplicationResult(commands, validTargets)
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,7 @@ export function keyboardSetFontWeightStrategy(
),
)

return strategyApplicationResult(
commands,
// FIXME: This was added as a default value in https://github.com/concrete-utopia/utopia/pull/6408
// This was to maintain the existing behaviour, but it should be replaced with a more specific value
// appropriate to this particular case.
'rerender-all-elements',
)
return strategyApplicationResult(commands, validTargets)
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,7 @@ export function keyboardSetOpacityStrategy(
setProperty('always', path, PP.create('style', 'opacity'), inputValue),
)

return strategyApplicationResult(
commands,
// FIXME: This was added as a default value in https://github.com/concrete-utopia/utopia/pull/6408
// This was to maintain the existing behaviour, but it should be replaced with a more specific value
// appropriate to this particular case.
'rerender-all-elements',
)
return strategyApplicationResult(commands, selectedElements)
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ export const setFlexGapStrategy: CanvasStrategyFactory = (
if (shouldTearOffGap) {
return strategyApplicationResult(
[deleteProperties('always', selectedElement, [StyleGapProp])],
// FIXME: This was added as a default value in https://github.com/concrete-utopia/utopia/pull/6408
// This was to maintain the existing behaviour, but it should be replaced with a more specific value
// appropriate to this particular case.
'rerender-all-elements',
selectedElements,
)
}

Expand All @@ -200,7 +197,7 @@ export const setFlexGapStrategy: CanvasStrategyFactory = (
},
]),
],
[...selectedElements, ...children.map((c) => c.elementPath)],
selectedElements,
)
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const setGridGapStrategy: CanvasStrategyFactory = (
},
]),
],
[...selectedElements, ...children.map((c) => c.elementPath)],
selectedElements,
)
},
}
Expand Down

0 comments on commit b8c8dcb

Please sign in to comment.