Fixed edge case with anchor links when using instant navigation

This commit is contained in:
squidfunk 2024-05-15 07:28:07 +02:00
parent d68db58553
commit 485fa76fbc
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 8 additions and 7 deletions

View File

@ -249,7 +249,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.5cfa9459.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.7c1205d0.min.js' | url }}"></script>
{% for script in config.extra_javascript %} {% for script in config.extra_javascript %}
{{ script | script_tag }} {{ script | script_tag }}
{% endfor %} {% endfor %}

View File

@ -370,10 +370,11 @@ export function setupInstantNavigation(
// the scroll restoration to the current page, as we don't need to restore // the scroll restoration to the current page, as we don't need to restore
// the viewport offset when the user navigates to a different page, as this // the viewport offset when the user navigates to a different page, as this
// is already handled by the previous observable. // is already handled by the previous observable.
location$.pipe( document$.pipe(
switchMap(() => location$),
distinctUntilKeyChanged("pathname"), distinctUntilKeyChanged("pathname"),
switchMap(() => location$), switchMap(() => location$),
distinctUntilKeyChanged("hash"), distinctUntilKeyChanged("hash")
), ),
// Handle instant navigation events that are triggered by the user clicking // Handle instant navigation events that are triggered by the user clicking