![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/rentpix.corals.io/vendor/swagger-api/swagger-ui/src/core/plugins/safe-render/ |
import React, { Component } from "react" export const componentDidCatch = console.error const isClassComponent = component => component.prototype && component.prototype.isReactComponent export const withErrorBoundary = (getSystem) => (WrappedComponent) => { const { getComponent, fn } = getSystem() const ErrorBoundary = getComponent("ErrorBoundary") const targetName = fn.getDisplayName(WrappedComponent) class WithErrorBoundary extends Component { render() { return ( <ErrorBoundary targetName={targetName} getComponent={getComponent} fn={fn}> <WrappedComponent {...this.props} {...this.context} /> </ErrorBoundary> ) } } WithErrorBoundary.displayName = `WithErrorBoundary(${targetName})` if (isClassComponent(WrappedComponent)) { /** * We need to handle case of class components defining a `mapStateToProps` public method. * Components with `mapStateToProps` public method cannot be wrapped. */ WithErrorBoundary.prototype.mapStateToProps = WrappedComponent.prototype.mapStateToProps } return WithErrorBoundary }