Repository: facebook/react
File: packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js (JavaScript)

Code before:
      // to create a StyleQueue.
      styleQueue = {
        start: renderState.startInlineStyle,
        precedence: stringToChunk(escapeTextForBrowser(precedence)),
        rules: ([]: Array<Chunk | PrecomputedChunk>),
        hrefs: ([]: Array<Chunk | PrecomputedChunk>),
        sheets: (new Map(): Map<string, StylesheetResource>),
      };
      renderState.styles.set(precedence, styleQueue);
    }

    const nonceStyle = renderState.nonce.style;
    if (!nonceStyle || nonceStyle === nonce) {
      if (__DEV__) {
        if (!nonceStyle && nonce) {
          console.error(
            'React encountered a hoistable style tag with "%s" nonce. The nonce was not passed to the render call though.',
            nonce,
          );
        }
      }
      styleQueue.hrefs.push(stringToChunk(escapeTextForBrowser(href)));
      pushStyleContents(styleQueue.rules, props);
    } else if (__DEV__) {
      console.error(
        'React encountered a hoistable style tag with "%s" nonce. It doesn\'t match the "%s" nonce passed to the render call. They have to be the same.',
        nonce,
        nonceStyle,
      );
    }
  }
  if (styleQueue) {
    // We need to track whether this boundary should wait on this resource or not.
    // Typically this resource should always exist since we either had it or just created
    // it. However, it's possible when you resume that the style has already been emitted
    // and then it wouldn't be recreated in the RenderState and there's no need to track
    // it again since we should've hoisted it to the shell already.
    if (hoistableState) {
      hoistableState.styles.add(styleQueue);
    }
  }

  if (textEmbedded) {
    // This link follows text but we aren't writing a tag. while not as efficient as possible we need
    // to be safe and assume text will follow by inserting a textSeparator
    target.push(textSeparator);
  }
}

/**
 * This escaping function is designed to work with style tag textContent only.

Review comment (suggestion):
```suggestion
        'React encountered a style tag with `precedence` "%s" and `nonce` "%s". When React manages style rules using `precedence` it will only include rules if the nonce matches the style nonce "%s" that was included with this render.',
```

Code after:
      // This is the first time we've encountered this precedence we need
      // to create a StyleQueue.
      styleQueue = {
        precedence: stringToChunk(escapeTextForBrowser(precedence)),
        rules: ([]: Array<Chunk | PrecomputedChunk>),
        hrefs: ([]: Array<Chunk | PrecomputedChunk>),
        sheets: (new Map(): Map<string, StylesheetResource>),
      };
      renderState.styles.set(precedence, styleQueue);
    }

    const nonceStyle = renderState.nonce.style;
    if (!nonceStyle || nonceStyle === nonce) {
      if (__DEV__) {
        if (!nonceStyle && nonce) {
          console.error(
            'React encountered a style tag with `precedence` "%s" and `nonce` "%s". When React manages style rules using `precedence` it will only include a nonce attributes if you also provide the same style nonce value as a render option.',
            precedence,
            nonce,
          );
        }
      }
      styleQueue.hrefs.push(stringToChunk(escapeTextForBrowser(href)));
      pushStyleContents(styleQueue.rules, props);
    } else if (__DEV__) {
      console.error(
        'React encountered a style tag with `precedence` "%s" and `nonce` "%s". When React manages style rules using `precedence` it will only include rules if the nonce matches the style nonce "%s" that was included with this render.',
        precedence,
        nonce,
        nonceStyle,
      );
    }
  }
  if (styleQueue) {
    // We need to track whether this boundary should wait on this resource or not.
    // Typically this resource should always exist since we either had it or just created
    // it. However, it's possible when you resume that the style has already been emitted
    // and then it wouldn't be recreated in the RenderState and there's no need to track
    // it again since we should've hoisted it to the shell already.
    if (hoistableState) {
      hoistableState.styles.add(styleQueue);
    }
  }

  if (textEmbedded) {
    // This link follows text but we aren't writing a tag. while not as efficient as possible we need
    // to be safe and assume text will follow by inserting a textSeparator
    target.push(textSeparator);
  }
}