refactor(app): wrap react with StrictMode [EE-2023] (#6075)

pull/6028/head
Chaim Lev-Ari 2021-11-16 18:33:51 +02:00 committed by GitHub
parent bcaf20caca
commit 5bd157f8fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -0,0 +1,10 @@
import { UIRouterContextComponent } from '@uirouter/react-hybrid';
import { PropsWithChildren, StrictMode } from 'react';
export function RootProvider({ children }: PropsWithChildren<unknown>) {
return (
<StrictMode>
<UIRouterContextComponent>{children}</UIRouterContextComponent>
</StrictMode>
);
}

View File

@ -1,7 +1,8 @@
import { UIRouterContextComponent } from '@uirouter/react-hybrid';
import ReactDOM from 'react-dom';
import { IComponentOptions, IController } from 'angular';
import { RootProvider } from './RootProvider';
function toProps(
propNames: string[],
controller: IController,
@ -44,10 +45,10 @@ export function react2angular<T>(
this.$onChanges = () => {
const props = toProps(propNames, this, $q);
ReactDOM.render(
<UIRouterContextComponent>
<RootProvider>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<Component {...(props as T)} />
</UIRouterContextComponent>,
</RootProvider>,
el
);
};