-
Notifications
You must be signed in to change notification settings - Fork 2.9k
RFC: slot children render function support #27164
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
RFC: slot children render function support #27164
Conversation
📊 Bundle size report🤖 This report was generated against 4f76849de438f2ee7842121ac3b8176ba1c0a2a5 |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7fc2f47:
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 4f76849de438f2ee7842121ac3b8176ba1c0a2a5 (build) |
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
|
Based on a discussion yesterday: the approach with |
|
@bsunderhus I prototyped a less breaking change that allows us to keep existing code or to do gradual changes: https://codesandbox.io/s/wispy-leftpad-f8yi37?file=/example.tsx. Key changes compared to current implementation:
That solution passing cases in this example. Key benefit is that we don't change other internals and don't need to apply changes to other hooks. The next step could be moving functionality of |
I'll see to add it as an option on the RFC! Thx for the contribution @layershifter! |
@layershifter @bsunderhus let's ask WISE (a.k.a @jspurlin) for their thoughts on this, they are a partner that have fully invested in composition |
ba8cbf7 to
ae02eee
Compare
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
|
@bsunderhus As RFC is quite big, would you mind to run |
09920aa to
bf41470
Compare
rfcs/react-components/convergence/slot-children-render-function.md
Outdated
Show resolved
Hide resolved
…n.md Co-authored-by: Oleksandr Fediashov <[email protected]>
…n.md Co-authored-by: Oleksandr Fediashov <[email protected]>
…n.md Co-authored-by: Oleksandr Fediashov <[email protected]>
…n.md Co-authored-by: Oleksandr Fediashov <[email protected]>
…n.md Co-authored-by: Oleksandr Fediashov <[email protected]>
…n.md Co-authored-by: Oleksandr Fediashov <[email protected]>
…n.md Co-authored-by: Oleksandr Fediashov <[email protected]>
…n.md Co-authored-by: Oleksandr Fediashov <[email protected]>
…n.md Co-authored-by: Oleksandr Fediashov <[email protected]>
e52cb86 to
7fc2f47
Compare
Summary
Slot children render function is a complex API that is not properly supported. #27089
To support this, this RFC proposes to create a custom JSX pragma to ensure slot declaration will not lose any property
and will be capable of properly rendering with children render function.
RFC
Current issues
Slot children render function won't override existing children. #27089
Repro: https://codesandbox.io/s/elated-babbage-46ez1w?file=/example.tsx
It's not possible to use children render function to override an entire slot, if
childrenare already used. The above is a minimal repro of an issue that can be seen in Fluent in theAccordionHeadercomponent. The component renders thebuttonslot which contains its own children. JSX children will win over props children - which is how children render functions are rendered bygetSlotsfluentui/packages/react-components/react-accordion/src/components/AccordionHeader/renderAccordionHeader.tsx
Lines 13 to 25 in 220b321
Requirements for children render function: