1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/packages/technical-features/react-application-root/src/react-application/react-application.tsx
Janne Savolainen de3fc32706
Introduce competition for starting react application inside the Feature
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
2023-03-31 08:39:30 +03:00

32 lines
1.1 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { DiContainerForInjection } from "@ogre-tools/injectable";
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx";
import { DiContextProvider } from "@ogre-tools/injectable-react";
import { flow, identity } from "lodash/fp";
import { observer } from "mobx-react";
import React from "react";
import { reactApplicationWrapperInjectionToken } from "./react-application-wrapper-injection-token";
import { ReactApplicationContent } from "./react-application-content";
interface ReactApplicationProps {
di: DiContainerForInjection;
}
export const ReactApplication = observer(({ di }: ReactApplicationProps) => {
const computedInjectMany = di.inject(computedInjectManyInjectable);
const wrappers = computedInjectMany(reactApplicationWrapperInjectionToken);
const ContentWithWrappers = flow(identity, ...wrappers.get())(ReactApplicationContent);
return (
<DiContextProvider value={{ di }}>
<ContentWithWrappers />
</DiContextProvider>
);
});