Skip to content
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 MathJax font override, avoid double initialization #15230

Merged
merged 4 commits into from
Oct 6, 2023

Conversation

bollwyvl
Copy link
Contributor

@bollwyvl bollwyvl commented Oct 6, 2023

References

Code changes

  • make the overload of TeXFont.defaultFonts static
  • move inner contents of protected _ensureInitialized to a Private namespace
    • use a PromiseDelegate to avoid race initilization conditions
    • load all used named MathJax imports in parallel
  • remove example 404 ignores
  • use font-display: swap to reduce FLOUC
    • tried some preload, etc. but the no-cache setting makes that... worse, and while loading Zero might be a win, it's hard to anticipate the rest...

User-facing changes

  • .woff fonts should no longer be downloaded twice from the default URL ({window.location}/js/output/chtml/)
  • multiple calls to typeset should not be able to enter the async init code twice

Backwards-incompatible changes

  • n/a

@jupyterlab-probot
Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

);

class EmptyFont extends TeXFont {
protected static defaultFonts = {} as any;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was the actual important thing

@bollwyvl bollwyvl marked this pull request as ready for review October 6, 2023 03:50
@bollwyvl
Copy link
Contributor Author

bollwyvl commented Oct 6, 2023

Presumably the example test passed: certainly not seeing the issue locally any longer. Not sure what the story is on the other UI tests.

@jtpio jtpio added this to the 4.0.x milestone Oct 6, 2023
@jtpio jtpio added bug and removed enhancement labels Oct 6, 2023
@jtpio
Copy link
Member

jtpio commented Oct 6, 2023

Nice, thanks!

I switched the label from enhancement to bug as this looks more like an issue with the current logic.

Also this can likely be backported to 4.0.x.

/js\/output\/chtml\/fonts\/tex-woff-v2\/MathJax_(Zero|Math-Italic|Main-Regular)\.woff$/
) === null
) {
if (msg.type() === 'error') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah these ignored error were suggesting something was not correct.

Copy link
Member

@jtpio jtpio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@github-actions github-actions bot added tag:CSS For general CSS related issues and pecadilloes Design System CSS labels Oct 6, 2023
@jtpio jtpio merged commit 3c3c65a into jupyterlab:main Oct 6, 2023
77 checks passed
@jtpio
Copy link
Member

jtpio commented Oct 6, 2023

@meeseeksdev please backport to 4.0.x

@lumberbot-app
Copy link

lumberbot-app bot commented Oct 6, 2023

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout 4.0.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 3c3c65ae03a758c620d8dd19678cb891d6bf0f20
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #15230: Fix MathJax font override, avoid double initialization'
  1. Push to a named branch:
git push YOURFORK 4.0.x:auto-backport-of-pr-15230-on-4.0.x
  1. Create a PR against branch 4.0.x, I would have named this PR:

"Backport PR #15230 on branch 4.0.x (Fix MathJax font override, avoid double initialization)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@bollwyvl
Copy link
Contributor Author

bollwyvl commented Oct 6, 2023

I'll take a look at the manual backport when i get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Design System CSS pkg:mathjax tag:CSS For general CSS related issues and pecadilloes tag:Examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants