MCPcopy
hub / github.com/facebook/react / renderActivity

Function renderActivity

packages/react-server/src/ReactFizzServer.js:2809–2850  ·  view source on GitHub ↗
(
  request: Request,
  task: Task,
  keyPath: KeyNode,
  props: ActivityProps,
)

Source from the content-addressed store, hash-verified

2807}
2808
2809function renderActivity(
2810 request: Request,
2811 task: Task,
2812 keyPath: KeyNode,
2813 props: ActivityProps,
2814): void {
2815 const segment = task.blockedSegment;
2816 if (segment === null) {
2817 // Replay
2818 const mode = props.mode;
2819 if (mode === 'hidden') {
2820 // A hidden Activity boundary is not server rendered. Prerendering happens
2821 // on the client.
2822 } else {
2823 // A visible Activity boundary has its children rendered inside the boundary.
2824 const prevKeyPath = task.keyPath;
2825 task.keyPath = keyPath;
2826 renderNode(request, task, props.children, -1);
2827 task.keyPath = prevKeyPath;
2828 }
2829 } else {
2830 // Render
2831 const mode = props.mode;
2832 if (mode === 'hidden') {
2833 // A hidden Activity boundary is not server rendered. Prerendering happens
2834 // on the client.
2835 } else {
2836 // An Activity boundary is delimited so that we can hydrate it separately.
2837 pushStartActivityBoundary(segment.chunks, request.renderState);
2838 segment.lastPushedText = false;
2839 // A visible Activity boundary has its children rendered inside the boundary.
2840 const prevKeyPath = task.keyPath;
2841 task.keyPath = keyPath;
2842 // We use the non-destructive form because if something suspends, we still
2843 // need to pop back up and finish the end comment.
2844 renderNode(request, task, props.children, -1);
2845 task.keyPath = prevKeyPath;
2846 pushEndActivityBoundary(segment.chunks, request.renderState);
2847 segment.lastPushedText = false;
2848 }
2849 }
2850}
2851
2852function renderViewTransition(
2853 request: Request,

Callers 1

renderElementFunction · 0.85

Calls 3

pushEndActivityBoundaryFunction · 0.90
renderNodeFunction · 0.85

Tested by

no test coverage detected