web/admin: fix error in admin interface due to un-hydrated context (#9336)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -166,7 +166,7 @@ export class AkAdminSidebar extends WithCapabilitiesConfig(AKElement) {
|
|||||||
${this.renderNewVersionMessage()}
|
${this.renderNewVersionMessage()}
|
||||||
${this.renderImpersonationMessage()}
|
${this.renderImpersonationMessage()}
|
||||||
${map(sidebarContent, renderOneSidebarItem)}
|
${map(sidebarContent, renderOneSidebarItem)}
|
||||||
${this.renderEnterpriseMessage()}
|
${this.renderEnterpriseMenu()}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ export class AkAdminSidebar extends WithCapabilitiesConfig(AKElement) {
|
|||||||
: nothing;
|
: nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderEnterpriseMessage() {
|
renderEnterpriseMenu() {
|
||||||
return this.can(CapabilitiesEnum.IsEnterprise)
|
return this.can(CapabilitiesEnum.IsEnterprise)
|
||||||
? html`
|
? html`
|
||||||
<ak-sidebar-item>
|
<ak-sidebar-item>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { EVENT_REFRESH } from "@goauthentik/authentik/common/constants";
|
import { EVENT_REFRESH } from "@goauthentik/authentik/common/constants";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
|
import { globalAK } from "@goauthentik/common/global";
|
||||||
import { authentikConfigContext } from "@goauthentik/elements/AuthentikContexts";
|
import { authentikConfigContext } from "@goauthentik/elements/AuthentikContexts";
|
||||||
|
|
||||||
import { ContextProvider } from "@lit/context";
|
import { ContextProvider } from "@lit/context";
|
||||||
@ -23,6 +24,9 @@ export class ConfigContextController implements ReactiveController {
|
|||||||
context: authentikConfigContext,
|
context: authentikConfigContext,
|
||||||
initialValue: undefined,
|
initialValue: undefined,
|
||||||
});
|
});
|
||||||
|
// Pre-hydrate from template-embedded config
|
||||||
|
this.context.setValue(globalAK().config);
|
||||||
|
this.host.config = globalAK().config;
|
||||||
this.fetch = this.fetch.bind(this);
|
this.fetch = this.fetch.bind(this);
|
||||||
this.fetch();
|
this.fetch();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user