Commit 5a04619
authored
[Flight] Properly close stream when no chunks need to be written after prerender (facebook#33982)
There is an edge case when prerendering where if you have nothing to
write you can end up in a state where the prerender is in status closed
before you can provide a destination. In this case the destination is
never closed becuase it assumes it already would have been.
This condition can happen now because of the introduction of the deubg
stream. Before this a request would never entere closed status if there
was no active destination. When a destination was added it would perform
a flush and possibly close the stream. Now, it is possible to flush
without a destination because you might have debug chunks to stream and
you can end up closing the stream independent of an active destination.
There are a number of ways we can solve this but the one that seems to
adhere best to the original design is to only set the status to CLOSED
when a destination is active. This means that if you don't have an
active destination when the pendingChunks count hits zero it will not
enter CLOSED status until you startFlowing.1 parent 129aa85 commit 5a04619
File tree
2 files changed
+44
-1
lines changed- packages
- react-server-dom-webpack/src/__tests__
- react-server/src
2 files changed
+44
-1
lines changedLines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
863 | 863 | | |
864 | 864 | | |
865 | 865 | | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
866 | 908 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5762 | 5762 | | |
5763 | 5763 | | |
5764 | 5764 | | |
| 5765 | + | |
5765 | 5766 | | |
5766 | 5767 | | |
5767 | 5768 | | |
| |||
5779 | 5780 | | |
5780 | 5781 | | |
5781 | 5782 | | |
5782 | | - | |
5783 | 5783 | | |
| 5784 | + | |
5784 | 5785 | | |
5785 | 5786 | | |
5786 | 5787 | | |
| |||
0 commit comments