mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-24 15:40:15 +01:00
Fixed hero component not being mounted with instant loading
This commit is contained in:
parent
a17c30c3ac
commit
c201b3de5f
@ -20,8 +20,7 @@
|
|||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { keys } from "ramda"
|
import { EMPTY, Observable, of } from "rxjs"
|
||||||
import { NEVER, Observable, of } from "rxjs"
|
|
||||||
import {
|
import {
|
||||||
distinctUntilChanged,
|
distinctUntilChanged,
|
||||||
map,
|
map,
|
||||||
@ -110,7 +109,7 @@ export function setupComponents(
|
|||||||
|
|
||||||
/* Re-compute component map on document switch */
|
/* Re-compute component map on document switch */
|
||||||
scan((prev, next) => {
|
scan((prev, next) => {
|
||||||
for (const name of keys(prev)) {
|
for (const name of names) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
|
|
||||||
/* Top-level components: update */
|
/* Top-level components: update */
|
||||||
@ -124,7 +123,10 @@ export function setupComponents(
|
|||||||
|
|
||||||
/* All other components: rebind */
|
/* All other components: rebind */
|
||||||
default:
|
default:
|
||||||
|
if (typeof next[name] !== "undefined")
|
||||||
prev[name] = getElement(`[data-md-component=${name}]`)
|
prev[name] = getElement(`[data-md-component=${name}]`)
|
||||||
|
else
|
||||||
|
delete prev[name]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return prev
|
return prev
|
||||||
@ -155,7 +157,7 @@ export function useComponent<T extends HTMLElement>(
|
|||||||
switchMap(components => (
|
switchMap(components => (
|
||||||
typeof components[name] !== "undefined"
|
typeof components[name] !== "undefined"
|
||||||
? of(components[name] as T)
|
? of(components[name] as T)
|
||||||
: NEVER
|
: EMPTY
|
||||||
)),
|
)),
|
||||||
distinctUntilChanged()
|
distinctUntilChanged()
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user