Changelog

Improving AppSignal, one deploy at a time.

Jul 03, 2024

Add span override prop to React error boundaries

JavaScript@appsignal/react@1.0.26

Added

  • Add a span override prop to the ErrorBoundary and LegacyBoundary components.

    Pass an override function to the error boundary component in order to set properties, such as tags, params or breadcrumbs, in the error span that will be sent to AppSignal.

    The override function is only called when an error is about to be sent. This allows you to only perform expensive computation to add information to the error when an error will actually be reported.

    When defined within a component, the function should be memoized with useCallback to prevent unnecessary re-renders:

    jsx
    export default const SomeComponent = ({ someProp }) => { const override = useCallback((span) => { span.setTags({ someProp }) }, [someProp]); return ( <ErrorBoundary override={override}> { /* Your component here */ } </ErrorBoundary> ) }

View the AppSignal JavaScript react v1.0.26 changelog for more information.

View all JavaScript updates

Start your free trial

Don’t let the bad bugs bite. Try AppSignal for free.

AppSignal offers a 30-day free trial, no credit card is required. All features are available in all plans. Start monitoring your application in just a few clicks!