Support cross-renderer portals
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 251k
- Forks
- 51.4k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 53
Description
Currently createPortal only works within the current renderer.
This means that if you want to embed one renderer into another (e.g. react-art in react-dom), your only option is to do an imperative render in a commit-time hook like componentDidMount or componentDidUpdate of the outer renderer's component. In fact that's exactly how react-art works today.
With this approach, nested renderers like react-art can't read the context of the outer renderers (https://github.com/facebook/react/issues/12796). Similarly, we can't time-slice updates in inner renderers because we only update the inner container at the host renderer's commit time.
At the time we originally discussed portals we wanted to make them work across renderers. So that you could do something like
<div>
<Portal to={ReactART}>
<surface>
<rect />
</surface>
</Portal>
</div>
But it's not super clear how this should work because renderers can bundle incompatible Fiber implementations. Whose implementation takes charge?
We'll want to figure something out eventually. For now I'm filing this for future reference.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the createPortal entry point and compare it with react-art's current imperative rendering from componentDidMount or componentDidUpdate. Investigate how incompatible Fiber implementations and renderer ownership affect context propagation and time-sliced updates. Done means a defined cross-renderer portal design that addresses those constraints.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100