The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/views/root/PortalWrapper.ts

31 lines
656 B

import type { ReactElement, ReactNode } from 'react';
import { PureComponent } from 'react';
type PortalWrapperProps = {
portal: ReactElement;
};
type PortalWrapperState = {
errored: boolean;
};
class PortalWrapper extends PureComponent<PortalWrapperProps, PortalWrapperState> {
state: PortalWrapperState = { errored: false };
static getDerivedStateFromError(): PortalWrapperState {
return { errored: true };
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
componentDidCatch(): void {}
render(): ReactNode {
if (this.state.errored) {
return null;
}
return this.props.portal;
}
}
export default PortalWrapper;