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
Possible Bug: Adding many 'font' options delays preview refresh #48
Comments
I tried adding a bunch of Do they all have the same font families? |
@bfintal You're right. I just used developer console Network tab and noticed the request is immediately sent, but the response takes 20 seconds to be sent. All my font pickers have Open Sans selected, so it's not the font. (Chrome console also says loading fonts and everything is started after that 18-20 seconds. I think it's related to the thing I mentioned in #44 . (where there were many errors for a few font fields). It could be so many connections made to the DB, or so much process, that makes it very slow when there are many font fields. And it's only in customizer preview, not in frontend or admin pages. |
I don't think it's related though to #44, not sure about #50. I'm doing #50 right now so we will see in a bit whether that's it. Maybe it's the loading of the new styles also in the Would you be able to investigate what it's doing in the 20 second response? |
Are you including the CSS files from Google asynchronously? That should speed up the rendering of the page a lot. The web fonts are displayed when they are completely loaded, without blocking any other request. Take a look at this: https://github.com/typekit/webfontloader#google Also, you can define just a subset of characters to download. That will speed up even more the download because you are not getting any unnecesary glyph, you just get the characters you need. |
@davidossahdez Nope, we're just including Google fonts the normal way via |
It's definitely server-side.
At the moment, I've reached this:
Which echoes a number like: 13.9210012300
So it's definitely coming from 'wp_head' action. |
It's all coming from class-theme-customizer-section.php printPreviewCSS() function. |
There's also another issue which is probably why the "font" option had a huge impact on speed. The same CSS code for each "font" option is generated and printed out 15 times. |
Wow, thanks for the findings! It shouldn't print that out so many times |
Okay so the problem was that |
@bfintal Thanks ! The first bug is fixed now. How about the other one? Font settings are printed out 15 times |
What's the second one? I thought everything was being slowed down because of the multiple printing of css? |
@bfintal Yeah that was mainly because of that. But still 1.4seconds for generating the CSS seems a bit too much. One reason for it is that every font CSS is generated and printed out 15 times. Example:
|
I just found out the above bug ^ (font settings CSS being repeated 15 times) is not only in the customizer, but also in the CSS file generated |
Awesome! It's fixed now. |
Haha, yes! Was just about to :) |
I don't know if it's a bug within TF or not, but it's really annoying.
I added 7 'font' options (6 of which are for h1 to h6). I also have 8 other 'font' options in other sections.
I noticed before, that when I add a 'font' option, it adds a delay for reloading the preview after editing an option that doesn't have 'livepreview'. (not necessarily a font option)
It's not because of low internet speed or server speed. The request to the server is made AFTER this delay. After I change an option, I also click on another option to trigger 'blur' and 'change' js events.
Now that I added 7 'font' options all at once, I'm noticing a huge delay before reloading the preview iframe.
With 8 'font' options it has about 8sec delay, and with 15 it has about 17sec delay.
Any idea what's causing this? Anyone else having the same issue?
The text was updated successfully, but these errors were encountered: