| 18935 | } |
| 18936 | |
| 18937 | function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { |
| 18938 | switch (renderState.tailMode) { |
| 18939 | case 'hidden': |
| 18940 | { |
| 18941 | // Any insertions at the end of the tail list after this point |
| 18942 | // should be invisible. If there are already mounted boundaries |
| 18943 | // anything before them are not considered for collapsing. |
| 18944 | // Therefore we need to go through the whole tail to find if |
| 18945 | // there are any. |
| 18946 | var tailNode = renderState.tail; |
| 18947 | var lastTailNode = null; |
| 18948 | |
| 18949 | while (tailNode !== null) { |
| 18950 | if (tailNode.alternate !== null) { |
| 18951 | lastTailNode = tailNode; |
| 18952 | } |
| 18953 | |
| 18954 | tailNode = tailNode.sibling; |
| 18955 | } // Next we're simply going to delete all insertions after the |
| 18956 | // last rendered item. |
| 18957 | |
| 18958 | |
| 18959 | if (lastTailNode === null) { |
| 18960 | // All remaining items in the tail are insertions. |
| 18961 | renderState.tail = null; |
| 18962 | } else { |
| 18963 | // Detach the insertion after the last node that was already |
| 18964 | // inserted. |
| 18965 | lastTailNode.sibling = null; |
| 18966 | } |
| 18967 | |
| 18968 | break; |
| 18969 | } |
| 18970 | |
| 18971 | case 'collapsed': |
| 18972 | { |
| 18973 | // Any insertions at the end of the tail list after this point |
| 18974 | // should be invisible. If there are already mounted boundaries |
| 18975 | // anything before them are not considered for collapsing. |
| 18976 | // Therefore we need to go through the whole tail to find if |
| 18977 | // there are any. |
| 18978 | var _tailNode = renderState.tail; |
| 18979 | var _lastTailNode = null; |
| 18980 | |
| 18981 | while (_tailNode !== null) { |
| 18982 | if (_tailNode.alternate !== null) { |
| 18983 | _lastTailNode = _tailNode; |
| 18984 | } |
| 18985 | |
| 18986 | _tailNode = _tailNode.sibling; |
| 18987 | } // Next we're simply going to delete all insertions after the |
| 18988 | // last rendered item. |
| 18989 | |
| 18990 | |
| 18991 | if (_lastTailNode === null) { |
| 18992 | // All remaining items in the tail are insertions. |
| 18993 | if (!hasRenderedATailFallback && renderState.tail !== null) { |
| 18994 | // We suspended during the head. We want to show at least one |