MCPcopy Index your code
hub / github.com/react/react / pushMeta

Function pushMeta

packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js:2789–2848  ·  view source on GitHub ↗
(
  target: Array<Chunk | PrecomputedChunk>,
  props: Object,
  renderState: RenderState,
  textEmbedded: boolean,
  formatContext: FormatContext,
)

Source from the content-addressed store, hash-verified

2787}
2788
2789function pushMeta(
2790 target: Array<Chunk | PrecomputedChunk>,
2791 props: Object,
2792 renderState: RenderState,
2793 textEmbedded: boolean,
2794 formatContext: FormatContext,
2795): null {
2796 const noscriptTagInScope = formatContext.tagScope & NOSCRIPT_SCOPE;
2797 const isFallback = formatContext.tagScope & FALLBACK_SCOPE;
2798 if (
2799 formatContext.insertionMode === SVG_MODE ||
2800 noscriptTagInScope ||
2801 props.itemProp != null
2802 ) {
2803 return pushSelfClosing(target, props, 'meta', formatContext);
2804 } else {
2805 if (textEmbedded) {
2806 // This link follows text but we aren't writing a tag. while not as efficient as possible we need
2807 // to be safe and assume text will follow by inserting a textSeparator
2808 target.push(textSeparator);
2809 }
2810
2811 if (isFallback) {
2812 // Hoistable Elements for fallbacks are simply omitted. we don't want to emit them early
2813 // because they are likely superceded by primary content and we want to avoid needing to clean
2814 // them up when the primary content is ready. They are never hydrated on the client anyway because
2815 // boundaries in fallback are awaited or client render, in either case there is never hydration
2816 return null;
2817 } else if (typeof props.charSet === 'string') {
2818 // "charset" Should really be config and not picked up from tags however since this is
2819 // the only way to embed the tag today we flush it on a special queue on the Request so it
2820 // can go before everything else. Like viewport this means that the tag will escape it's
2821 // parent container.
2822 return pushSelfClosing(
2823 renderState.charsetChunks,
2824 props,
2825 'meta',
2826 formatContext,
2827 );
2828 } else if (props.name === 'viewport') {
2829 // "viewport" is flushed on the Request so it can go earlier that Float resources that
2830 // might be affected by it. This means it can escape the boundary it is rendered within.
2831 // This is a pragmatic solution to viewport being incredibly sensitive to document order
2832 // without requiring all hoistables to be flushed too early.
2833 return pushSelfClosing(
2834 renderState.viewportChunks,
2835 props,
2836 'meta',
2837 formatContext,
2838 );
2839 } else {
2840 return pushSelfClosing(
2841 renderState.hoistableChunks,
2842 props,
2843 'meta',
2844 formatContext,
2845 );
2846 }

Callers 1

pushStartInstanceFunction · 0.85

Calls 2

pushSelfClosingFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected