DEV Community

Eddie
Eddie

Posted on

What React team is working on? (part two - forwards & backwards revealOrder)

Okay. Several days after merging this commit:


Sebastian opened another pull request to the master branch. In this pull request, He added two more options for the "revealOrder" property.

Working DEMO

1. forwards

This option makes the child suspense components to show their contents in order from the first one to the last.
For example, consider the same code from the previous post; but this time with "revealOrder" property set to "forwards":

Now if the FirstSuspendingComponent resolves first, it will show its content immediately. But if the SecondSuspendingComponent resolves before the FirstSuspendingComponent, It will wait for the FirstSuspendingComponent to resolve. After that, they both will display their contents at the same time.

2. backwards

"backwards" actually acts as the reverse of the "forwards." Every Suspense component will wait for other Suspenses which came after it to resolve before showing its content.

PR:

Add forwards and backwards options to SuspenseList #15918

Builds on top of #15902

I'm not super happy with this implementation yet but it seems to work. I also need more tests.

So putting it out there as an early review.

Top comments (0)