Fixed instant loading not triggering when going back to initial page

This commit is contained in:
squidfunk
2023-02-10 19:24:18 +01:00
parent 090ae52059
commit 329d26d34a
4 changed files with 7 additions and 8 deletions

View File

@@ -240,7 +240,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.4b2c34cd.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.56494524.min.js' | url }}"></script>
{% for path in config.extra_javascript %} {% for path in config.extra_javascript %}
<script src="{{ path | url }}"></script> <script src="{{ path | url }}"></script>
{% endfor %} {% endfor %}

View File

@@ -170,10 +170,9 @@ export function setupInstantLoading(
/* Intercept history back and forward */ /* Intercept history back and forward */
const pop$ = fromEvent<PopStateEvent>(window, "popstate") const pop$ = fromEvent<PopStateEvent>(window, "popstate")
.pipe( .pipe(
filter(ev => ev.state !== null),
map(ev => ({ map(ev => ({
url: new URL(location.href), url: new URL(location.href),
offset: ev.state offset: ev.state ?? {}
})), })),
share<HistoryState>() share<HistoryState>()
) )