Skip to content

πŸ™Œ OpenHands: AI-Driven Development

hotifx(frontend): Critical fix for black screen (#8158)

sp.wack38578bd5f544
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 96ab4e1950..618a694eba 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -44,7 +44,6 @@
"react-router": "^7.5.3",
"react-syntax-highlighter": "^15.6.1",
"react-textarea-autosize": "^8.5.9",
- "react-toastify": "^11.0.5",
"remark-gfm": "^4.0.1",
"sirv-cli": "^3.0.1",
"socket.io-client": "^4.8.1",
@@ -14681,19 +14680,6 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
- "node_modules/react-toastify": {
- "version": "11.0.5",
- "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-11.0.5.tgz",
- "integrity": "sha512-EpqHBGvnSTtHYhCPLxML05NLY2ZX0JURbAdNYa6BUkk+amz4wbKBQvoKQAB0ardvSarUBuY4Q4s1sluAzZwkmA==",
- "license": "MIT",
- "dependencies": {
- "clsx": "^2.1.1"
- },
- "peerDependencies": {
- "react": "^18 || ^19",
- "react-dom": "^18 || ^19"
- }
- },
"node_modules/read-cache": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
diff --git a/frontend/src/entry.client.tsx b/frontend/src/entry.client.tsx
index a605d8475c..b778bb733a 100644
--- a/frontend/src/entry.client.tsx
+++ b/frontend/src/entry.client.tsx
@@ -13,21 +13,35 @@ import posthog from "posthog-js";
import "./i18n";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import store from "./store";
-import { useConfig } from "./hooks/query/use-config";
import { AuthProvider } from "./context/auth-context";
import { queryClientConfig } from "./query-client-config";
+import OpenHands from "./api/open-hands";
+import { displayErrorToast } from "./utils/custom-toast-handlers";
function PosthogInit() {
- const { data: config } = useConfig();
+ const [posthogClientKey, setPosthogClientKey] = React.useState<string | null>(
+ null,
+ );
React.useEffect(() => {
- if (config?.POSTHOG_CLIENT_KEY) {
- posthog.init(config.POSTHOG_CLIENT_KEY, {
+ (async () => {
+ try {
+ const config = await OpenHands.getConfig();
+ setPosthogClientKey(config.POSTHOG_CLIENT_KEY);
+ } catch (error) {
+ displayErrorToast("Error fetching PostHog client key");
+ }
+ })();
+ }, []);
+
+ React.useEffect(() => {
+ if (posthogClientKey) {
+ posthog.init(posthogClientKey, {
api_host: "https://us.i.posthog.com",
person_profiles: "identified_only",
});
}
- }, [config]);
+ }, [posthogClientKey]);
return null;
}