Giter Club home page Giter Club logo

Comments (15)

pthalamy avatar pthalamy commented on May 10, 2024 2

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.

MSNev avatar MSNev commented on May 10, 2024 1

@Karlie-777 can you please investigate @pthalamy issue with v3.3.3

from applicationinsights-react-js.

ronaldsutantio avatar ronaldsutantio commented on May 10, 2024 1

Hi @Karlie-777

My bad, I was referring to this issue: #7.

to reproduce the issue:

  1. install latest react version
  2. install latest @microsoft/applicationinsights-react-j (3.3.4)

from applicationinsights-react-js.

MSNev avatar MSNev commented on May 10, 2024 1

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.

erikostling avatar erikostling commented on May 10, 2024

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.

ksmigiel avatar ksmigiel commented on May 10, 2024

Yep, we also cannot perform upgrade to React 18 due to this peer dependency.

from applicationinsights-react-js.

MSNev avatar MSNev commented on May 10, 2024

microsoft/ApplicationInsights-JS#1820

from applicationinsights-react-js.

MSNev avatar MSNev commented on May 10, 2024

Reopening for tracking

from applicationinsights-react-js.

cloudstr21 avatar cloudstr21 commented on May 10, 2024

Any update / solution for this issue? I currently facing same issue after upgrade to React 18.1.0

from applicationinsights-react-js.

Karlie-777 avatar Karlie-777 commented on May 10, 2024

@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.

pthalamy avatar pthalamy commented on May 10, 2024

@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.

Karlie-777 avatar Karlie-777 commented on May 10, 2024

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.

pthalamy avatar pthalamy commented on May 10, 2024

@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.

MSNev avatar MSNev commented on May 10, 2024

#15

from applicationinsights-react-js.

github-actions avatar github-actions commented on May 10, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.