-
Notifications
You must be signed in to change notification settings - Fork 77
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
Refactor getElementProp
across child components as an outdated pattern.
#6038
Labels
4 - verified
Issues that have been released and confirmed resolved.
estimate - 8
Requires input from team, consider smaller steps.
low risk
Issues with low risk for consideration in low risk milestones
p - medium
Issue is non core or affecting less that 60% of people using the library
refactor
Issues tied to code that needs to be significantly reworked.
Milestone
Comments
getElementProp
across child components as an outdated pattern.
16 tasks
I've implemented this kind of pattern with |
This was referenced May 18, 2023
Elijbet
added a commit
that referenced
this issue
Jul 8, 2023
…ion-mode` and `scale` can now be set as props or attributes (#7191) **Related Issue:** #6199, #6038, #6200 ## Summary This should resolve #6199, where you're able to set `accordionEl.setAttribute("icon-position", "start")`, but not `accordionEl.iconPosition = "start"`, happening because of a logical issue within `getElementProp` function. `getElementProp` is being refactored across child components as an outdated pattern in #6038, so this will also kick off that issue as well. Instead of the `accordion-item` looking up the parent for `iconPosition, iconType, selectionMode, or scale`, these get set by the `accordion` parent. The logic for setting these props thus moves to the parent, getting rid of the `getElementProp` altogether. The parent component gets a `mutation observer` to do this as well as `watchers` for when it needs to modify the children. With the `mutationObserver` added, there is no longer a need for the `calciteInternalAccordionItemRegister` event logic.
getElementProp
across child components as an outdated pattern.
Elijbet
added a commit
that referenced
this issue
Aug 23, 2023
…s refactored out across child components as an outdated pattern in favor of inheritable props set directly on parent (#7562) **Related Issue:** #6038 ## Summary `getElementProp` is refactored out across child components as an outdated pattern in favor of inheritable props set directly on the parent. Instead of the `combobox-item` and `combobox-group` looking up the parent for scale, these get set by the combobox parent. The logic for setting these props thus moves to the parent, getting rid of the `getElementProp altogether`. The parent component gets a mutation observer to do this as well as watchers for when it needs to modify the children. Inherited props addressed: - [x] `scale` - [x] `selectionMode`
This was referenced Aug 23, 2023
Elijbet
added a commit
that referenced
this issue
Aug 24, 2023
…op` is refactored out in favor of inheritable props set directly on parent (#7582) **Related Issue:** #6038 ## Summary `getElementProp` is refactored out across child components as an outdated pattern in favor of inheritable props set directly on the parent. The logic for setting these props thus moves to the parent, getting rid of the `getElementProp` altogether. The parent component gets a `mutationObserver` to do this as well as `watchers` for when it needs to modify the children. Inherited props addressed: - [x] `scale` is inherited from `dropdown`, - [x] `selectionMode` is inherited from `dropdown-item-group`, so there can be a mix of types within one dropdown.
Elijbet
added a commit
that referenced
this issue
Aug 25, 2023
… is refactored out in favor of inheritable props set directly on parent (#7592) **Related Issue:** #6038 ## Summary `getElementProp` is refactored out across child components as an outdated pattern in favor of inheritable props set directly on the parent. Instead of the `segmented-control-item` looking up the parent for `appearance`, `layout`, and `scale`, these get set by the `segmented-control` parent. The logic for setting these props thus moves to the parent, getting rid of the `getElementProp` altogether. The parent component gets a `mutationObserver` to do this and watchers for when it needs to modify the children. Inherited props addressed: - [x] appearance - [x] layout - [x] scale --------- Co-authored-by: Ben Elan <[email protected]>
2 tasks
getElementProp
across child components as an outdated pattern.
jcfranco
added a commit
that referenced
this issue
Aug 31, 2023
…n favor of inheritable props set directly on parent (#7593) **Related Issue:** #6038 ## Summary `getElementProp` is refactored out across child components as an outdated pattern in favor of inheritable props set directly on the parent. Instead of the `stepper-item` looking up the parent for `icon, layout, numbered, and scale`, these get set by the `stepper` parent. The logic for setting these props thus moves to the parent, getting rid of the `getElementProp` altogether. The parent component gets a `mutationObserver` to do this as well as watchers for when it needs to modify the children. Inherited props addressed: - [x] icon - [x] layout - [x] numbered - [x] scale --------- Co-authored-by: Matt Driscoll <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: JC Franco <[email protected]> Co-authored-by: Anveshreddy mekala <[email protected]>
Elijbet
added a commit
that referenced
this issue
Oct 30, 2023
…ed out in favor of inheritable props set directly on parent (#7605) **Related Issue:** #6038 ## Summary `getElementProp` is refactored out across child components as an outdated pattern in favor of inheritable props set directly on the parent. Instead of the `tab, tab-title, tab-nav` looking up the parent for `position` and `scale`, these get set by the `tabs` parent. The logic for setting these props thus moves to the parent, getting rid of the `getElementProp` altogether. The parent component gets a `mutationObserver` to achieve this and watchers for when it needs to modify the children. Child attribute selectors are subbed with new classes added dynamically to reflect the scale and position, as attributes are no longer reflected to be targeted. Inherited props addressed: - [x] position - [x] scale
Verified in the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
4 - verified
Issues that have been released and confirmed resolved.
estimate - 8
Requires input from team, consider smaller steps.
low risk
Issues with low risk for consideration in low risk milestones
p - medium
Issue is non core or affecting less that 60% of people using the library
refactor
Issues tied to code that needs to be significantly reworked.
Description
Refactor
getElementProp
across child components as an outdated pattern.Parents should be setting props on the child if it’s a tightly coupled component pair. With this current pattern if the parent prop changes the child doesn't know about the changes to the parent.
For all relevant components props are passed down and children no longer look up for the prop. To achieve this the parent gets a mutation observer to modify children where necessary.
Proposed Advantages
Which Component
All coupled components: where the child shares their parent’s name, like
list/list-item, flow/flow-item, combobox/combobox-item
.iconType
iconPosition
scale
selectionMode
scale
selectionMode
scale
scale
scale
selectionMode
scale
appearance
layout
icon
numbered
layout
scale
position
scale
The text was updated successfully, but these errors were encountered: