Comments (15)
I am also having this issue on React 17 (React 17.0.2, @types/react 17.0.43, @types/react-dom 17.0.14) since I upgraded @microsoft/applicationinsights-react-js to 3.3.3 from 3.3.1.
from applicationinsights-react-js.
@Karlie-777 can you please investigate @pthalamy issue with v3.3.3
from applicationinsights-react-js.
Hi @Karlie-777
My bad, I was referring to this issue: #7.
to reproduce the issue:
- install latest react version
- install latest @microsoft/applicationinsights-react-j (3.3.4)
from applicationinsights-react-js.
FYI - New React repo is now live and we are planning an initial unpinning from v2.8.5 of ApplicationInsights release tomorrow (no other changes are included for this initial repo release)
from applicationinsights-react-js.
Also affected by this. Please prioritize as this prevents upgrading to React 18, or at least using AppInsights in React 18 apps.
from applicationinsights-react-js.
Yep, we also cannot perform upgrade to React 18 due to this peer dependency.
from applicationinsights-react-js.
microsoft/ApplicationInsights-JS#1820
from applicationinsights-react-js.
Reopening for tracking
from applicationinsights-react-js.
Any update / solution for this issue? I currently facing same issue after upgrade to React 18.1.0
from applicationinsights-react-js.
@cloudstr21 do you mind sharing more details? We added children component in 2.8.3 release and the following code seems working for me with latest plugin version
<AppInsightsErrorBoundary appInsights={reactPlugin} onError= {()=> {return <h1>Error Element</h1>}}>
<></>
</AppInsightsErrorBoundary>
from applicationinsights-react-js.
@Karlie-777 Here is my code and the associated error:
import { AppInsightsErrorBoundary } from "@microsoft/applicationinsights-react-js";
import * as React from "react";
import { fooInsightsReactPlugin } from "@shared/Telemetry/fooInsights";
import { ErrorPage } from "./ErrorPage";
import { ErrorPageAction } from "./errorPageActionTypes";
export const FooErrorBoundary: React.FC = (props) => {
return (
<AppInsightsErrorBoundary
onError={() => <ErrorPage action={ErrorPageAction.ReloadPage} />}
appInsights={fooInsightsReactPlugin}
>
{props.children}
</AppInsightsErrorBoundary>
);
};
And the error on {props.children}
, which I have to ts-ignore
since the @microsoft/applicationinsights-react-js 3.3.3
update:
No overload matches this call.
Overload 1 of 2, '(props: IAppInsightsErrorBoundaryProps | Readonly<IAppInsightsErrorBoundaryProps>): AppInsightsErrorBoundary', gave the following error.
Type 'ReactNode' is not assignable to type 'ReactElement<any, string | JSXElementConstructor<any>> & ReactNode'.
Type 'undefined' is not assignable to type 'ReactElement<any, string | JSXElementConstructor<any>> & ReactNode'.
Overload 2 of 2, '(props: IAppInsightsErrorBoundaryProps, context: any): AppInsightsErrorBoundary', gave the following error.
Type 'ReactNode' is not assignable to type 'ReactElement<any, string | JSXElementConstructor<any>> & ReactNode'.
from applicationinsights-react-js.
For errors in React.FC
, please refer facebook/create-react-app#8177
And to solve this issue, adding fragment should help:
export const FooErrorBoundary: React.FC = (props) => {
return (
<AppInsightsErrorBoundary
onError={() => <ErrorPage action={ErrorPageAction.ReloadPage} />}
appInsights={fooInsightsReactPlugin}
>
<>
{props.children}
</>
</AppInsightsErrorBoundary>
);
};
from applicationinsights-react-js.
@Karlie-777 Indeed this is what's changed, adding the React fragment solved the issue. Didn't think of trying this.
from applicationinsights-react-js.
from applicationinsights-react-js.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from applicationinsights-react-js.
Related Issues (20)
- AppInsightsErrorBoundary: Add custom property HOT 3
- [BUG] AppInsightsErrorBoundary doesn't handle errors from the children components in React 18 HOT 2
- [BUG] ReactPlugin becomes undefined after certain amount of time HOT 2
- Is any version compatible with react 15? HOT 2
- Does useTrackEvent trigger re-render? HOT 6
- [BUG] Events shown twice in App Insights HOT 3
- [BUG] 'AppInsightsErrorBoundary' cannot be used as a JSX component. HOT 4
- [BUG] Type 'ReactPlugin' is not assignable to type 'ITelemetryPlugin' HOT 64
- Tracking api call HOT 2
- Doesn't appear to be secure HOT 3
- ApplicationInsights-JS v3 Compatibility HOT 1
- Uncaught TypeError: Cannot redefine property: pathname when calling appInsights.loadAppInsights(); HOT 8
- [Documentation] Include common react usecases. HOT 1
- Cross-site cookies blocking impact HOT 1
- useTrackEvents skipFirstRun not working properly in React strict mode HOT 2
- [BUG] v17.0.0 Fails to compile with yarn pnp HOT 5
- AppInsightsErrorBoundary: option to clear hasError (e.g. when using browser back) HOT 10
- [BUG] applicationinsights-web is leaking memory in NextJS SSR HOT 16
- [BUG] Sample App - link update HOT 1
- [BUG] Page view loading time not correct HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from applicationinsights-react-js.