-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ref(scraps): remove compactSelect triggerProps #105215
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
Draft
TkDodo
wants to merge
29
commits into
master
Choose a base branch
from
tkdodo/ref/remove-compactSelect-triggerProps
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while we shouldn't provide `triggerProps` _and_ `trigger` to a `CompactSelect`, we do create an `id` that we label the `ul` by, so this id must be put onto the trigger. This does happen for the default trigger, but not if you provide your own. This PR fixes this by passing the id to the props that will eventually get spread onto the trigger.
…/remove-compactSelect-triggerProps
…dodo/ref/remove-compactSelect-triggerProps
# Conflicts: # static/app/components/core/compactSelect/control.tsx
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #105215 +/- ##
========================================
Coverage 80.62% 80.62%
========================================
Files 9428 9428
Lines 404023 404015 -8
Branches 25661 25659 -2
========================================
- Hits 325724 325718 -6
+ Misses 77830 77828 -2
Partials 469 469 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
and replace them with a dedicated
triggerfunction that renders a<SelectTrigger.Button>depends on:
closes: https://linear.app/getsentry/issue/DE-668/streamline-compactselect-triggers
Most of the changes were done automatically by a codemod, but I checked them all afterwards.
The biggest change that was migrated wrongly is that passing
children: undefinedorchildren: nullintriggerPropsbefore led to the default children being rendered, for example:The 1:1 migration would be:
But this won’t work because falling back to
undefinedmeans nothing gets rendered.So the new pattern is falling back to
triggerProps.children:trigger={triggerProps => ( <SelectTrigger.Button {...triggerProps} prefix={t('Geo region')}> - {value.length === 0 ? t('All') : undefined} + {value.length === 0 ? t('All') : triggerProps.children} </SelectTrigger.Button> )}As
triggerPropscontains thedefaultLabelaschildren, but the expression inside the body ofSelectTrigger.Buttoncompletely overrides that.this is the commit where I made most of these changes: 33f22a5
To make this future-proof, I’ve disallowed
undefinedandnullon type-level aschildrenfor forSelectTrigger