Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting hugging parent to fixed is optional when converting to absolute #4354

Merged
merged 11 commits into from
Oct 12, 2023

Conversation

gbalint
Copy link
Contributor

@gbalint gbalint commented Oct 11, 2023

Problem:
This is a followup PR to #4318
The goal was to make it optional to set the size of a hugging parent to fixed.

Fix:

  • I modified the convertToAbsoluteAndMove strategy, now it is a factory function of two different strategies: one which sets the hugging parent size to fixed and one which does not do that.
  • I also added an extra parameter to the RUN_ESCAPE_HATCH strategy, so now there are two ways to invoke it.
  • The fitness of the strategy which sets the hugging parent to fixed size is a little larger than the fitness of the other one, so setting the hugging parent to fixed size is still the default behavior. However, the user can manually choose the other strategy if necessary.
  • As an extra I removed some redundant code and replaced the custom size fixing code with a call to sizeToVisualDimensions

@github-actions
Copy link
Contributor

github-actions bot commented Oct 11, 2023

Try me

@relativeci
Copy link

relativeci bot commented Oct 11, 2023

Job #8591: Bundle Size — 63.28MiB (~+0.01%).

3f0dedb(current) vs 5957b21 master#8589(baseline)

Warning

Bundle contains 64 duplicate packages – View duplicate packages

Bundle metrics  Change 1 change Regression 1 regression
                 Current
Job #8591
     Baseline
Job #8589
Regression  Initial JS 35.57MiB(~+0.01%) 35.57MiB
No change  Initial CSS 0B 0B
No change  Cache Invalidation 18.9% 18.9%
No change  Chunks 28 28
No change  Assets 32 32
No change  Modules 4016 4016
No change  Duplicate Modules 456 456
No change  Duplicate Code 31.36% 31.36%
No change  Packages 409 409
No change  Duplicate Packages 64 64
Bundle size by type  Change 1 change Regression 1 regression
                 Current
Job #8591
     Baseline
Job #8589
Regression  JS 63.27MiB (~+0.01%) 63.27MiB
Not changed  HTML 11.54KiB 11.54KiB

View job #8591 reportView feature/two-convert-to-absolute-... branch activity

@github-actions
Copy link
Contributor

github-actions bot commented Oct 11, 2023

Performance test results:
(Chart1)
(Chart2)

@gbalint gbalint changed the title Setting parent to fixed is optional when converting to absolute Setting hugging parent to fixed is optional when converting to absolute Oct 11, 2023
@gbalint gbalint marked this pull request as ready for review October 11, 2023 13:09
Comment on lines +126 to +139
if (
!retargetedTargets.every((element) => {
const elementMetadata = MetadataUtils.findElementByElementPath(
canvasState.startingMetadata,
element,
)
return (
elementMetadata?.specialSizeMeasurements.position !== 'absolute' &&
honoursPropsPosition(canvasState, element)
)
})
) {
return null
}
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO this should also be returning null if this is the set-hugging-parent-to-fixed variant and the parent is not hugging, otherwise we end up providing 2 alternatives to the user that have no difference, which means that when there is a difference between the two the user might not even realise that

return [
...commands,
...sizeToVisualDimensions(metadata, pathTree, ancestor),
showToastCommand('Parent is set to fixed size', 'NOTICE', 'set-parent-to-fixed-size'),
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect we don't need this toast any more if we're providing this as an explicit option

@gbalint gbalint marked this pull request as draft October 11, 2023 14:53
@gbalint gbalint marked this pull request as ready for review October 12, 2023 07:40
@bkrmendy bkrmendy merged commit ee70fd1 into master Oct 12, 2023
@bkrmendy bkrmendy deleted the feature/two-convert-to-absolute-strategies branch October 12, 2023 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants