mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed race condition ehen displaying search result metadata
This commit is contained in:
parent
905c8b77c6
commit
8779d78a13
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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 %}
|
||||
|
@ -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$))
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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$))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user