web: Controller refinements, error handling (#14700)
* web: Partial fix for issue where config is not consistently available. * web: Fix issues surrounding controller readiness. * web: Catch abort errors when originating when wrapped by OpenAPI or Sentry. * web: Fix color on dark mode. --------- Co-authored-by: Simonyi Gergő <gergo@goauthentik.io>
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
import { DEFAULT_CONFIG } from "#common/api/config";
|
||||
import { EVENT_REFRESH } from "#common/constants";
|
||||
import { isAbortError } from "#common/errors/network";
|
||||
import { isCausedByAbortError } from "#common/errors/network";
|
||||
import { VersionContext, VersionMixin } from "#elements/mixins/version";
|
||||
import type { ReactiveElementHost } from "#elements/types";
|
||||
|
||||
import { Context, ContextProvider } from "@lit/context";
|
||||
import { ContextProvider } from "@lit/context";
|
||||
import type { ReactiveController } from "lit";
|
||||
|
||||
import { AdminApi, Version } from "@goauthentik/api";
|
||||
@ -14,7 +14,7 @@ export class VersionContextController implements ReactiveController {
|
||||
#abortController: null | AbortController = null;
|
||||
|
||||
#host: ReactiveElementHost<VersionMixin>;
|
||||
#context: ContextProvider<Context<unknown, Version>>;
|
||||
#context: ContextProvider<VersionContext>;
|
||||
|
||||
constructor(host: ReactiveElementHost<VersionMixin>, initialValue?: Version) {
|
||||
this.#host = host;
|
||||
@ -41,7 +41,7 @@ export class VersionContextController implements ReactiveController {
|
||||
})
|
||||
|
||||
.catch((error: unknown) => {
|
||||
if (isAbortError(error)) {
|
||||
if (isCausedByAbortError(error)) {
|
||||
this.#log("Aborted fetching license summary");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user