-
Couldn't load subscription status.
- Fork 49.7k
Fix #34969: [Fizz] Don't emit streaming instructions when using onAllReady #34974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ng onAllReady This fix addresses issue facebook#34966 where renderToPipeableStream with the onAllReady callback incorrectly injected streaming scripts and hidden HTML elements even when all content was fully loaded. Changes: - Modified flushSegment in ReactFizzServer.js to check allPendingTasks > 0 before outlining Suspense boundaries - Modified flushCompletedQueues in ReactFizzServer.js to skip blocking shell instructions when allPendingTasks === 0 - Modified writeCompletedRoot in ReactFizzConfigDOM.js to only emit template tag when not complete - Updated test snapshots to reflect new behavior (no streaming instructions when using onAllReady) - Added new test file ReactDOMFizzServerNodeIssue34966-test.js to verify the fix This prevents unnecessary streaming scripts and hidden elements from being injected when using onAllReady for SEO crawlers, improving SEO scores. Co-Authored-By: Vedant Khanna <[email protected]>
|
Hi @VedantKh! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
This PR appears to be a duplicate of my work in #34969, which was created 4 hours earlier.
**In open source when someone has already submitted a solution, you should review/collaborate on that PR, not create a competing one... If you want to improve an existing PR, you can offer suggestions or request to contribute commits. Creating a duplicate PR 4 hours later, especially using AI, is not appropriate Please close this PR as a duplicate of #34969. If you have improvements to suggest, I'm happy to review them on my PR. U even use my comments 🤦♀️ Proof of my original work:
|
|
Apologies! I was testing an applet I built that automatically reviews GitHub Issues and submits PRs with a single click, and I clicked on the issue you submitted a PR to without looking into it too deeply. The agent probably noticed your work and took heavy inspiration from it. Didn't mean to take any undue credit! |
|
If you have any improvement feel free to suggest changes in #34969 so everything will be in one place and you will be then co-author of the changes made |
Fixes #34966
Summary
This PR fixes an issue where
renderToPipeableStreamwith theonAllReadycallback incorrectly injected streaming scripts and hidden HTML elements even when all content was fully loaded. This negatively impacted SEO scores for crawlers.Changes
flushSegmentinReactFizzServer.jsto checkallPendingTasks > 0before outlining Suspense boundariesflushCompletedQueuesinReactFizzServer.jsto skip blocking shell instructions whenallPendingTasks === 0writeCompletedRootinReactFizzConfigDOM.jsto only emit template tag when not completeReactDOMFizzServerNodeIssue34966-test.jsto verify the fixTest Plan
ReactDOMFizzServerNodeIssue34966-test.jsonShellReadymodeBefore:
After:
Clean HTML with no streaming scripts, hidden elements, or template tags when using
onAllReady.Link to Devin run: https://app.devin.ai/sessions/7c96c346bafa4e9fb3db53359e2e9c30
Requested by: Vedant Khanna ([email protected]) (@VedantKh)
Analysis session: devin-f682e0bd30014103a2590bcb6e053cb4