mirror of https://github.com/portainer/portainer
refactor(app): wrap react with StrictMode [EE-2023] (#6075)
parent
bcaf20caca
commit
5bd157f8fc
|
@ -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>
|
||||
);
|
||||
}
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue