Skip to content

Commit

Permalink
web/admin: fix error in admin interface due to un-hydrated context (#…
Browse files Browse the repository at this point in the history
…9336)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
  • Loading branch information
BeryJu authored Apr 18, 2024
1 parent 9f5d708 commit 2e9df96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/src/admin/AdminInterface/AdminSidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class AkAdminSidebar extends WithCapabilitiesConfig(AKElement) {
${this.renderNewVersionMessage()}
${this.renderImpersonationMessage()}
${map(sidebarContent, renderOneSidebarItem)}
${this.renderEnterpriseMessage()}
${this.renderEnterpriseMenu()}
`;
}

Expand Down Expand Up @@ -199,7 +199,7 @@ export class AkAdminSidebar extends WithCapabilitiesConfig(AKElement) {
: nothing;
}

renderEnterpriseMessage() {
renderEnterpriseMenu() {
return this.can(CapabilitiesEnum.IsEnterprise)
? html`
<ak-sidebar-item>
Expand Down
4 changes: 4 additions & 0 deletions web/src/elements/Interface/ConfigContextController.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { EVENT_REFRESH } from "@goauthentik/authentik/common/constants";
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
import { globalAK } from "@goauthentik/common/global";
import { authentikConfigContext } from "@goauthentik/elements/AuthentikContexts";

import { ContextProvider } from "@lit/context";
Expand All @@ -23,6 +24,9 @@ export class ConfigContextController implements ReactiveController {
context: authentikConfigContext,
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();
}
Expand Down

0 comments on commit 2e9df96

Please sign in to comment.