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

Exclusive/complementary constraint resolution for group children #4282

Merged
merged 2 commits into from
Oct 2, 2023

Conversation

ruggi
Copy link
Contributor

@ruggi ruggi commented Oct 2, 2023

Fixes #4281

Problem:

It's possible to over-specify group child constraints, e.g. setting both left, right, and width.

Kapture 2023-10-02 at 11 54 13

Fix:

  1. When setting a dimension constraint (w/h), if both the side complements (tlbr) are set, remove the oldest constraint
  2. When setting a side constraint (tlbr), if both the dimension complements (w/h) are set, remove the dimension complement (so side pins win)

Kapture 2023-10-02 at 11 56 51

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2023

Try me

@relativeci
Copy link

relativeci bot commented Oct 2, 2023

Job #8339: Bundle Size — 62.7MiB (~+0.01%).

6f34c44(current) vs 5957b21 master#8338(baseline)

Warning

Bundle contains 64 duplicate packages - View duplicate packages

Bundle metrics (1 change)
                 Current
Job #8339
     Baseline
Job #8338
Initial JS 34.97MiB(~+0.01%) 34.97MiB
Initial CSS 0B 0B
Cache Invalidation 18.38% 18.38%
Chunks 27 27
Assets 31 31
Modules 3970 3970
Duplicate Modules 422 422
Duplicate Code 30.83% 30.83%
Packages 409 409
Duplicate Packages 64 64
Bundle size by type (1 change)
                 Current
Job #8339
     Baseline
Job #8338
CSS 0B 0B
Fonts 0B 0B
HTML 11.43KiB 11.43KiB
IMG 0B 0B
JS 62.69MiB (~+0.01%) 62.69MiB
Media 0B 0B
Other 0B 0B

View job #8339 reportView feat/exclusive-constraint-props branch activity

}

function maybeRemoveOldestComplement(
set: Set<any>,
Copy link
Contributor

@bkrmendy bkrmendy Oct 2, 2023

Choose a reason for hiding this comment

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

since we set the data-constraints prop via Utopia, I think it'd be worth it to validate its value getSafeGroupChildConstraintsArray so that we only take into account the valid values, and ignore whatever else that might have made its way into the prop (and get rid the anys stemming from getSafeGroupChildConstraintsArray

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, done in 6f34c44 (#4282)

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2023

Performance test results:
(Chart1)
(Chart2)

@ruggi ruggi merged commit 6d31dc1 into master Oct 2, 2023
13 checks passed
@ruggi ruggi deleted the feat/exclusive-constraint-props branch October 2, 2023 10:43
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.

When setting constraints on group children, resolve stuttering over-constraining
3 participants