diff --git a/src/providers/ClickHouseContext.jsx b/src/providers/ClickHouseContext.jsx index 6a1b479..a7444de 100644 --- a/src/providers/ClickHouseContext.jsx +++ b/src/providers/ClickHouseContext.jsx @@ -10,6 +10,18 @@ import { createClient } from "@clickhouse/client-web"; import { toast } from "sonner"; import { analyticsQueries } from "@/helpers/instanceAnalyticsQueries"; +// Polyfill for crypto.randomUUID if not available +if (typeof crypto.randomUUID !== "function") { + crypto.randomUUID = function () { + return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) => + ( + c ^ + (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))) + ).toString(16) + ); + }; +} + const ClickHouseContext = createContext(); const ClickHouseProvider = ({ children }) => {