mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
revert: "fix(website): Handle JS errors during Mixpanel init" (#5685)
Reverts firezone/firezone#5684
This commit is contained in:
@@ -3,7 +3,6 @@ import { useEffect, Suspense } from "react";
|
||||
import { usePathname, useSearchParams } from "next/navigation";
|
||||
import { useMixpanel } from "react-mixpanel-browser";
|
||||
import { HubSpotSubmittedFormData } from "./types";
|
||||
import ErrorBoundary from "@/components/ErrorBoundary";
|
||||
|
||||
function _Mixpanel() {
|
||||
const pathname = usePathname();
|
||||
@@ -64,11 +63,9 @@ function _Mixpanel() {
|
||||
|
||||
export function Mixpanel() {
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
<Suspense>
|
||||
<_Mixpanel />
|
||||
</Suspense>
|
||||
</ErrorBoundary>
|
||||
<Suspense>
|
||||
<_Mixpanel />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import React, { ReactNode, useEffect } from "react";
|
||||
|
||||
interface ErrorBoundaryProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
const ErrorBoundary: React.FC<ErrorBoundaryProps> = ({ children }) => {
|
||||
useEffect(() => {
|
||||
const handleErrors = (event: ErrorEvent) => {
|
||||
console.error("ErrorBoundary caught an error", event.error);
|
||||
};
|
||||
|
||||
window.addEventListener("error", handleErrors);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("error", handleErrors);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return <>{children}</>;
|
||||
};
|
||||
|
||||
export default ErrorBoundary;
|
||||
Reference in New Issue
Block a user