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

Fixes to "staying on the same page functionality" (version with tests removed) #7559

Merged
merged 4 commits into from
Sep 27, 2024

Commits on Sep 26, 2024

  1. Extract function for core logic of "staying on the same page when swi…

    …tching versions"
    
    This commit is a no-op refactor to make reviewing the following commit
    easier.
    ilyagr committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    a083eff View commit details
    Browse the repository at this point in the history
  2. Fixes to "staying on the same page functionality"

    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`.
    ilyagr committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    244130a View commit details
    Browse the repository at this point in the history
  3. Make sure selectedVersionCorrespondingURL never throws an exception

    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`.
    ilyagr committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    b368435 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3e86c64 View commit details
    Browse the repository at this point in the history