diff --git a/packages/@ourworldindata/grapher/src/core/Grapher.tsx b/packages/@ourworldindata/grapher/src/core/Grapher.tsx index 164b0e5eb54..ed0b5d920ee 100644 --- a/packages/@ourworldindata/grapher/src/core/Grapher.tsx +++ b/packages/@ourworldindata/grapher/src/core/Grapher.tsx @@ -858,7 +858,11 @@ export class Grapher */ @computed get useAdminAPI(): boolean { if (typeof window === "undefined") return false - return window.admin !== undefined + return ( + window.admin !== undefined && + // Ensure that we're not accidentally matching on a DOM element with an ID of "admin" + typeof window.admin.isSuperuser === "boolean" + ) } @computed get isUserLoggedInAsAdmin(): boolean {