mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed handling of 4xx status codes when using instant loading
This commit is contained in:
parent
684acdcc78
commit
8beda2bfe1
29
material/assets/javascripts/bundle.c2e1ee47.min.js
vendored
Normal file
29
material/assets/javascripts/bundle.c2e1ee47.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -214,7 +214,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.ed9748b7.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.c2e1ee47.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 %}
|
||||||
|
18
material/overrides/assets/javascripts/bundle.2bc01bfd.min.js
vendored
Normal file
18
material/overrides/assets/javascripts/bundle.2bc01bfd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -19,5 +19,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script src="{{ 'overrides/assets/javascripts/bundle.641d98f2.min.js' | url }}"></script>
|
<script src="{{ 'overrides/assets/javascripts/bundle.2bc01bfd.min.js' | url }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -24,11 +24,12 @@ import {
|
|||||||
EMPTY,
|
EMPTY,
|
||||||
Observable,
|
Observable,
|
||||||
catchError,
|
catchError,
|
||||||
filter,
|
|
||||||
from,
|
from,
|
||||||
map,
|
map,
|
||||||
|
of,
|
||||||
shareReplay,
|
shareReplay,
|
||||||
switchMap
|
switchMap,
|
||||||
|
throwError
|
||||||
} from "rxjs"
|
} from "rxjs"
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
@ -51,8 +52,11 @@ export function request(
|
|||||||
): Observable<Response> {
|
): Observable<Response> {
|
||||||
return from(fetch(`${url}`, options))
|
return from(fetch(`${url}`, options))
|
||||||
.pipe(
|
.pipe(
|
||||||
filter(res => res.status === 200),
|
catchError(() => EMPTY),
|
||||||
catchError(() => EMPTY)
|
switchMap(res => res.status !== 200
|
||||||
|
? throwError(() => new Error(res.statusText))
|
||||||
|
: of(res)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
|
|
||||||
import { Repo, User } from "github-types"
|
import { Repo, User } from "github-types"
|
||||||
import {
|
import {
|
||||||
|
EMPTY,
|
||||||
Observable,
|
Observable,
|
||||||
|
catchError,
|
||||||
defaultIfEmpty,
|
defaultIfEmpty,
|
||||||
map,
|
map,
|
||||||
zip
|
zip
|
||||||
@ -65,6 +67,7 @@ export function fetchSourceFactsFromGitHub(
|
|||||||
/* Fetch version */
|
/* Fetch version */
|
||||||
requestJSON<Release>(`${url}/releases/latest`)
|
requestJSON<Release>(`${url}/releases/latest`)
|
||||||
.pipe(
|
.pipe(
|
||||||
|
catchError(() => EMPTY), // @todo refactor instant loading
|
||||||
map(release => ({
|
map(release => ({
|
||||||
version: release.tag_name
|
version: release.tag_name
|
||||||
})),
|
})),
|
||||||
@ -74,6 +77,7 @@ export function fetchSourceFactsFromGitHub(
|
|||||||
/* Fetch stars and forks */
|
/* Fetch stars and forks */
|
||||||
requestJSON<Repo>(url)
|
requestJSON<Repo>(url)
|
||||||
.pipe(
|
.pipe(
|
||||||
|
catchError(() => EMPTY), // @todo refactor instant loading
|
||||||
map(info => ({
|
map(info => ({
|
||||||
stars: info.stargazers_count,
|
stars: info.stargazers_count,
|
||||||
forks: info.forks_count
|
forks: info.forks_count
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
|
|
||||||
import { ProjectSchema } from "gitlab"
|
import { ProjectSchema } from "gitlab"
|
||||||
import {
|
import {
|
||||||
|
EMPTY,
|
||||||
Observable,
|
Observable,
|
||||||
|
catchError,
|
||||||
defaultIfEmpty,
|
defaultIfEmpty,
|
||||||
map
|
map
|
||||||
} from "rxjs"
|
} from "rxjs"
|
||||||
@ -49,6 +51,7 @@ export function fetchSourceFactsFromGitLab(
|
|||||||
const url = `https://${base}/api/v4/projects/${encodeURIComponent(project)}`
|
const url = `https://${base}/api/v4/projects/${encodeURIComponent(project)}`
|
||||||
return requestJSON<ProjectSchema>(url)
|
return requestJSON<ProjectSchema>(url)
|
||||||
.pipe(
|
.pipe(
|
||||||
|
catchError(() => EMPTY), // @todo refactor instant loading
|
||||||
map(({ star_count, forks_count }) => ({
|
map(({ star_count, forks_count }) => ({
|
||||||
stars: star_count,
|
stars: star_count,
|
||||||
forks: forks_count
|
forks: forks_count
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
EMPTY,
|
||||||
Observable,
|
Observable,
|
||||||
|
catchError,
|
||||||
defaultIfEmpty,
|
defaultIfEmpty,
|
||||||
map,
|
map,
|
||||||
of,
|
of,
|
||||||
@ -97,6 +99,7 @@ export function fetchSitemap(base?: URL): Observable<Sitemap> {
|
|||||||
map(sitemap => preprocess(getElements("loc", sitemap)
|
map(sitemap => preprocess(getElements("loc", sitemap)
|
||||||
.map(node => node.textContent!)
|
.map(node => node.textContent!)
|
||||||
)),
|
)),
|
||||||
|
catchError(() => EMPTY), // @todo refactor instant loading
|
||||||
defaultIfEmpty([]),
|
defaultIfEmpty([]),
|
||||||
tap(sitemap => __md_set("__sitemap", sitemap, sessionStorage, base))
|
tap(sitemap => __md_set("__sitemap", sitemap, sessionStorage, base))
|
||||||
)
|
)
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
import {
|
import {
|
||||||
EMPTY,
|
EMPTY,
|
||||||
Subject,
|
Subject,
|
||||||
|
catchError,
|
||||||
combineLatest,
|
combineLatest,
|
||||||
filter,
|
filter,
|
||||||
fromEvent,
|
fromEvent,
|
||||||
@ -73,6 +74,9 @@ export function setupVersionSelector(
|
|||||||
const versions$ = requestJSON<Version[]>(
|
const versions$ = requestJSON<Version[]>(
|
||||||
new URL("../versions.json", config.base)
|
new URL("../versions.json", config.base)
|
||||||
)
|
)
|
||||||
|
.pipe(
|
||||||
|
catchError(() => EMPTY) // @todo refactor instant loading
|
||||||
|
)
|
||||||
|
|
||||||
/* Determine current version */
|
/* Determine current version */
|
||||||
const current$ = versions$
|
const current$ = versions$
|
||||||
|
Loading…
Reference in New Issue
Block a user