-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fix issue when requirejs/domReady could delay rendering of content #25527
Conversation
Fixes magento/magento#22909
Hi @ihor-sviziev. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
Added label "not required" because it was discussed already in #23313 (comment) |
@magento give me test instance |
Hi @ihor-sviziev. Thank you for your request. I'm working on Magento instance for you |
Hi @ihor-sviziev, here is your new Magento instance. |
Fixes magento/magento#22909
Fixes magento/magento#22909
@magento give me test instance |
Hi @ihor-sviziev. Thank you for your request. I'm working on Magento instance for you |
Hi @ihor-sviziev, here is your new Magento instance. |
Fixes magento/magento#22909
@magento give me 2.3-develop instance |
Hi @krzksz. Thank you for your request. I'm working on Magento 2.3-develop instance for you |
Hi @krzksz, here is your Magento instance. |
@magento give me test instance |
Hi @krzksz. Thank you for your request. I'm working on Magento instance for you |
Hi @krzksz, here is your new Magento instance. |
@@ -10,7 +10,8 @@ | |||
<title>Magento Admin</title> | |||
<meta name="viewport" content="width=1024"/> | |||
<meta name="format-detection" content="telephone=no"/> | |||
<link src="requirejs/require.js"/> | |||
<script src="requirejs/require.js"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was mistake, it should be script, so I fixed it
✔️ QA Passed Result with slow 3g slow mode enabled in Google Chrome dev console: Original - first load: 49.3 sec, second load: 12 sec; |
Thanks for the hard work on this! I'll be reviewing asap |
Really appreciate the work here, and for trying out an alternative solution! Good to have options :) Having said that, I'm not quite comfortable with the current implementation in this PR. By design, the most critical content in Magento is rendered on the server, and we can consider most JS stuff on storefront pages "secondary content," as it will always be ready after the rest of the content. Adding a synchronous I'd consider adding Will see if I can find some quick time to get some comparisons of the traces between this and #23313, to help visualize. |
@magento give me test instance |
Hi @DrewML. Thank you for your request. I'm working on Magento instance for you |
Hi @DrewML, here is your new Magento instance. |
@DrewML, In comparison to #23313 we fixed comparison for state to all known states, it will prevent any issues in case if some browser will introduce any “initializing”, or some browser specific state. Another thing that we fixed - loading script that detects if page is already loaded at first priority, that’s really terrible solution to load it in general queue as it’s on critical path of page load |
FWIW, we're a few weeks away from removing the "alpha" state on that. At this point, Baler has had more production usage that almost any other new feature we've released before, because we did the early alpha.
I'm not super familiar with our release cycle, but my understanding is that, if we merged this today, it wouldn't be in a release very soon, right? I just want to avoid a situation where we merge something we know we'll remove in a few months, because our backwards-compat requirements make that stuff difficult. If we know it's going to be pulled out shortly, it would be preferable for someone to publish a temporary patch for folks that want to try it out.
Luckily this isn't something we have to worry much about. This check is an extremely common pattern, and both the WHATWG and W3C have strong requirements to not break the web when adding new features. But it's also a fairly trivial change to update that logic in the other PR, if we did go with it.
Agreed. But, while we don't want it to be low priority, we definitely don't want it to be the top priority, because there is other code in the graph that should be executing sooner. Let me do some tracing and come back here with some numbers on various metrics, that way we have less guessing to do :) |
Also worth mentioning that changing the |
Hi @DrewML, |
Hey @DrewML do you have any updates on this PR? |
The PR is under architecture review now |
If we can see traces showing that this improves key performance metrics without regressing any, I'd be happy to move forward. But right now, this PR does not align with plans for front-end performance unfortunately. A goal in 2020 for me is to have everyone using Moving
Like all things performance, I'm happy to be proven wrong if there are traces that can tell a different story :) |
Hi @DrewML, |
Hi @ihor-sviziev, thank you for your contribution! |
Description (*)
This PR adds requirejs/domReady to head section just after requirejs library, so requirejs will not load requirejs/domReady himself.
As result browser starting loading all magento scripts earlier as there is no delay for loading domReady file anymore.
More info (including benchmarks): #23313 (comment)
Fixed Issues (if relevant)
Manual testing scenarios (*)
<img src="https://httpstat.us/404?sleep=10000" />
(I added this toMagento_Theme::html/absolute_footer.phtml
)sleep
value of the asset, however private / JavaScript content should render before this finishes (I used theDefault welcome msg!
text in the header to verify this)Questions or comments
Contribution checklist (*)