-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fixes to "staying on the same page functionality" (version with tests removed) #7559
Conversation
815eeae
to
0b3cc93
Compare
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`.
OK, done. |
Thanks, LGTM! |
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.
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.
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
.