1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-12 10:00:52 +01:00

Fixed race condition ehen displaying search result metadata

This commit is contained in:
squidfunk 2021-10-06 14:57:27 +02:00
parent 905c8b77c6
commit 8779d78a13
6 changed files with 17 additions and 22 deletions

View File

@ -225,7 +225,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.39a44d95.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.bc35569b.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script>
{% endfor %}

View File

@ -107,12 +107,8 @@ export function mountSearch(
tx$
.pipe(
filter(isSearchQueryMessage),
sample(rx$
.pipe(
filter(isSearchReadyMessage),
take(1)
)
)
sample(rx$.pipe(filter(isSearchReadyMessage))),
take(1)
)
.subscribe(tx$.next.bind(tx$))

View File

@ -33,6 +33,7 @@ import {
finalize,
map,
observeOn,
skipUntil,
switchMap,
take,
tap,
@ -102,20 +103,18 @@ export function mountSearchResult(
const list = getElementOrThrow(":scope > :last-child", el)
/* Update search result metadata when ready */
rx$
const ready$ = rx$
.pipe(
filter(isSearchReadyMessage),
take(1)
)
.subscribe(() => {
resetSearchResultMeta(meta)
})
/* Update search result metadata */
internal$
.pipe(
observeOn(animationFrameScheduler),
withLatestFrom(query$)
withLatestFrom(query$),
skipUntil(ready$)
)
.subscribe(([{ items }, { value }]) => {
if (value)

View File

@ -127,10 +127,10 @@ export function setupSearchWorker(
/* Set up search index */
from(index)
.pipe(
map<SearchIndex, SearchSetupMessage>(data => ({
map(data => ({
type: SearchMessageType.SETUP,
data: setupSearchIndex(data)
}))
} as SearchSetupMessage))
)
.subscribe(tx$.next.bind(tx$))