Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow DevTools to toggle Suspense fallbacks #15232
ReactDOM: size: 0.0%, gzip:
Details of bundled changes.
3 times, most recently
Mar 29, 2019
I don't think this is sufficient for DevTools to do feature detection.
We should probably add a new prop to where we do the injection that signals whether the current version+build supports this override behavior. This way DevTools won't display a confusing button that doesn't work.
Looking at the implementation, I'm curious: why not inject a method e.g.
That could work. However, I wanted to make it so that the condition can be adjusted dynamically, and doesn't necessarily have to be "here's a Set of Fibers". For example it would be nice if we could do a quick check based on some predicate. Leaving it as a method in DevTools hook makes that a bit more flexible.
I hadn't realized that you were thinking of supporting a feature like "reload and step through suspense boundaries". Given that, deferring to DevTools does make more sense.
I'm not entirely comfortable with the current solution for injection in the reload-and-do-something case, but it's reasonable to assume this could piggy back off of whatever solution we end up with there.
I updated the PR to a different API. Now it exposes
The upside of this is that it makes it easy to feature-test whether a particular React renderer supports this feature from DevTools.
Note that while this moves the override to render injection (as opposed to reading a field from the Global Hook), it doesn't actually make it any harder to "pause" the first render. If we wanted, we could call
I've also added a CM test.
After conversation with Sebastian, I plan to make a few more changes:
In the future, we'll move away from the
Nice nice! I like both of those changes
Interesting. I'd love to talk more about this. I'm a little wary of the shadowing idea. (We've talked about this a bit in the past, either with you or Sebastian I forget.)