Fixes to "staying on the same page functionality" (version with tests removed)#7559
Merged
squidfunk merged 4 commits intosquidfunk:masterfrom Sep 27, 2024
Merged
Fixes to "staying on the same page functionality" (version with tests removed)#7559squidfunk merged 4 commits intosquidfunk:masterfrom
squidfunk merged 4 commits intosquidfunk:masterfrom
Conversation
815eeae to
0b3cc93
Compare
Owner
|
Thanks for doing this! To be clear, I did not say that we do not want tests, it's just the wrong time to start with it right now. Two things: please change your filenameing convention to how we structured the rest of this repository – find a shorter name and put it into a directory, as the rest of the entire TypeScript codebase, something like Additionally, please add a description to the functions, so that comments are complete, and please fix the remaining checks. |
…tching versions" This commit is a no-op refactor to make reviewing the following commit easier.
This is squidfunk#7350 with the tests removed, as requested in squidfunk#7350 (comment) . I do urge you to reconsider and merge something like squidfunk#7350 (including the tests I wrote) instead. Without tests, I suspect this code will break like its [previous version did]( squidfunk@ceacfe5) . Once the code does break, it might be difficult to fix without tests. Even if other parts of the theme work without tests, and even if you aren't in love with how I set up the infrastructure in squidfunk#7350 or squidfunk#7338, I think this logic is complex enough to need tests to be maintainable. Again, I wouldn't be able to check this code's correctness without the tests that aren't included in this PR. Of course, this is your project to maintain, so do what works best for you. I just hope this bugfix helps. --------------------- Fixes squidfunk#7226 Additionally, this allows using the version switcher even if the website is published at a different URL than the `site_url`. In particular, the version switcher should now work locally when serving the site with `mike serve`.
I polyfilled `URL.parse` since many browsers don't support it yet, apparently. I'd like this function to never throw an exception, any error should lead to it simply returning `undefined`.
Contributor
Author
|
OK, done. |
Owner
|
Thanks, LGTM! |
ilyagr
added a commit
to jj-vcs/jj
that referenced
this pull request
Sep 29, 2024
This will hopefully make the version switcher stay on the same page as it includes squidfunk/mkdocs-material#7559. Unfortunately, it might break again for reasons explained there.
ilyagr
added a commit
to jj-vcs/jj
that referenced
this pull request
Sep 29, 2024
This will hopefully make the version switcher stay on the same page as it includes squidfunk/mkdocs-material#7559. Unfortunately, it might break again for reasons explained there.
2 tasks
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 is #7350 with the tests removed, as requested in
#7350 (comment) .
I do urge you to reconsider and merge something like #7350 (including
the tests I wrote) instead. Without tests, I suspect this code will
break like its previous version did
. Once the code does break, it might be difficult to fix without tests.
Even if other parts of the theme work without tests, and even if you aren't in love with
how I set up the infrastructure in #7350 or #7338, I think this logic is complex enough
to need tests to be maintainable. Again, I wouldn't be able to check this code's correctness
without the tests that aren't included in this PR. You can always change
the infrastructure to something you like better later.
Of course, this is your project to maintain, so do what works best for you. If
this is the version that's most helpful to you, hope it helps!
Fixes #7226
Additionally, this allows using the version switcher even if the website
is published at a different URL than the
site_url. In particular,the version switcher should now work locally when serving the site with
mike serve.