Improved semantics when returning from switchMap

This commit is contained in:
squidfunk 2022-03-08 10:31:38 +01:00
parent eea6d1eec4
commit 1d1cf476c8
11 changed files with 18 additions and 20 deletions

View File

@ -214,7 +214,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.130b2e88.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.897f3768.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

@ -16,5 +16,5 @@
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
{{ super() }} {{ super() }}
<script src="{{ 'overrides/assets/javascripts/bundle.2e51be42.min.js' | url }}"></script> <script src="{{ 'overrides/assets/javascripts/bundle.a375bc7d.min.js' | url }}"></script>
{% endblock %} {% endblock %}

View File

@ -260,7 +260,7 @@ export function setupInstantLoading(
.pipe( .pipe(
skip(1), skip(1),
map(() => getComponentElement("container")), map(() => getComponentElement("container")),
switchMap(el => of(...getElements("script", el))), switchMap(el => getElements("script", el)),
concatMap(el => { concatMap(el => {
const script = h("script") const script = h("script")
if (el.src) { if (el.src) {

View File

@ -25,7 +25,6 @@ import {
fromEvent, fromEvent,
mapTo, mapTo,
mergeMap, mergeMap,
of,
switchMap, switchMap,
takeWhile, takeWhile,
tap, tap,
@ -63,9 +62,9 @@ export function patchIndeterminate(
): void { ): void {
document$ document$
.pipe( .pipe(
switchMap(() => of(...getElements<HTMLInputElement>( switchMap(() => getElements<HTMLInputElement>(
"[data-md-state=indeterminate]" "[data-md-state=indeterminate]"
))), )),
tap(el => { tap(el => {
el.indeterminate = true el.indeterminate = true
el.checked = false el.checked = false

View File

@ -26,7 +26,6 @@ import {
fromEvent, fromEvent,
mapTo, mapTo,
mergeMap, mergeMap,
of,
switchMap, switchMap,
tap tap
} from "rxjs" } from "rxjs"
@ -77,7 +76,7 @@ export function patchScrollfix(
): void { ): void {
document$ document$
.pipe( .pipe(
switchMap(() => of(...getElements("[data-md-scrollfix]"))), switchMap(() => getElements("[data-md-scrollfix]")),
tap(el => el.removeAttribute("data-md-scrollfix")), tap(el => el.removeAttribute("data-md-scrollfix")),
filter(isAppleDevice), filter(isAppleDevice),
mergeMap(el => fromEvent(el, "touchstart") mergeMap(el => fromEvent(el, "touchstart")

View File

@ -218,7 +218,7 @@ export function mountIconSearchResult(
.pipe( .pipe(
bufferCount(10), bufferCount(10),
zipWith(boundary$), zipWith(boundary$),
switchMap(([chunk]) => of(...chunk)) switchMap(([chunk]) => chunk)
) )
)), )),
withLatestFrom(query$) withLatestFrom(query$)

View File

@ -108,7 +108,7 @@ export function resolve(
return from(glob(pattern, options)) return from(glob(pattern, options))
.pipe( .pipe(
catchError(() => EMPTY), catchError(() => EMPTY),
switchMap(files => from(files)), switchMap(files => files),
options?.watch options?.watch
? mergeWith(watch(pattern, options)) ? mergeWith(watch(pattern, options))
: identity : identity