fix: delay processing of KaTeX#778
Merged
david-christiansen merged 5 commits intomainfrom Mar 2, 2026
Merged
Conversation
This PR delays the processing of KaTeX until files are actually being generated, rather than adding its assets to the traverse state. This makes traversal faster and allows clients to completely opt out of deserializing it.
Contributor
|
Preview for this PR is ready! 🎉 |
robsimmons
reviewed
Mar 2, 2026
Comment on lines
+156
to
+160
| match features with | ||
| | ⟨true, true⟩ => #[.KaTeX, .search] | ||
| | ⟨true, false⟩ => #[.KaTeX] | ||
| | ⟨false, true⟩ => #[.search] | ||
| | ⟨false, false⟩ => #[] |
Collaborator
There was a problem hiding this comment.
Seems like this is immediately regrettable as soon as there's a third thing. How about
Suggested change
| match features with | |
| | ⟨true, true⟩ => #[.KaTeX, .search] | |
| | ⟨true, false⟩ => #[.KaTeX] | |
| | ⟨false, true⟩ => #[.search] | |
| | ⟨false, false⟩ => #[] | |
| #[ if features.hasKatex then #[.KaTeX] else #[], | |
| if features.hasSearch then #[.search] else #[], ].flatten |
Collaborator
There was a problem hiding this comment.
better, probably: keep the pattern match ⟨isKatex, isSearch⟩ so that there's a type error when a feature gets added
Collaborator
Author
There was a problem hiding this comment.
That was the thought process! Though if we start getting more features, we will want some other implementation of this, akin to what you're suggesting, and we can easily mitigate this risk by proving an appropriate lemma.
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.
This PR delays the processing of KaTeX until files are actually being generated, rather than adding its assets to the traverse state. This makes traversal faster and allows clients to completely opt out of deserializing it.