[Fiber] Don't warn when rendering data block scripts#35953
Merged
Conversation
|
Comparing: 4cc5b7a...34da60f Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
rickhanlonii
approved these changes
Mar 3, 2026
Member
rickhanlonii
left a comment
There was a problem hiding this comment.
Why was this warning only enabled for enableTrustedTypes anyway?
Collaborator
Author
There were plans to enable the warning everywhere after some considerations: #16157 (comment) Probably just forgotten to revisit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
React will commit
<script>tags client-side in a way to blocks them from execution. When that happens we issue a warning when trusted types integration is enabled (introduced in #16157).However, scripts that contain data blocks (e.g.
application/ld+json) are not executed by user agents anyway. In those cases React will no longer warn with this change. Especially because you couldn't follow the warning and put the<script>'s content in a<template>instead and have it work the same way.How did you test this change?