Fixed sequential execution of scripts when using instant loading

This commit is contained in:
squidfunk 2020-08-30 13:37:59 +02:00
parent 9ab9508f9b
commit 935c384789
6 changed files with 7 additions and 11 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"assets/javascripts/bundle.js": "assets/javascripts/bundle.d23ec273.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.d23ec273.min.js.map",
"assets/javascripts/bundle.js": "assets/javascripts/bundle.f0e39e8b.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.f0e39e8b.min.js.map",
"assets/javascripts/vendor.js": "assets/javascripts/vendor.11f47dfd.min.js",
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.11f47dfd.min.js.map",
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.fae956e7.min.js",

View File

@ -183,7 +183,7 @@
</div>
{% block scripts %}
<script src="{{ 'assets/javascripts/vendor.11f47dfd.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.d23ec273.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.f0e39e8b.min.js' | url }}"></script>
{%- set translations = {} -%}
{%- for key in [
"clipboard.copy",

View File

@ -23,7 +23,6 @@
import { EMPTY, Observable, noop, of } from "rxjs"
import {
concatMap,
filter,
map,
skip,
switchMap,
@ -74,7 +73,6 @@ export function patchScripts(
els$
.pipe(
switchMap(els => of(...els)),
filter(el => !!el.src || /(^|\/javascript)$/i.test(el.type)),
concatMap(el => {
const script = createElement("script")
if (el.src) {
@ -83,9 +81,7 @@ export function patchScripts(
/* Complete when script is loaded */
return new Observable(observer => {
script.onload = () => {
observer.complete()
}
script.onload = () => observer.complete()
})
/* Complete immediately */