feat: isolated plugin system (#2742)

This commit is contained in:
Himself65
2023-06-09 16:43:46 +08:00
committed by GitHub
parent af6f431c15
commit f2ac2e5b84
51 changed files with 489 additions and 209 deletions

View File

@@ -0,0 +1,23 @@
import { ProviderComposer } from '@affine/component/provider-composer';
import { ThemeProvider } from '@affine/component/theme-provider';
import { rootStore } from '@toeverything/plugin-infra/manager';
import { Provider } from 'jotai';
import type { PropsWithChildren } from 'react';
import { useMemo } from 'react';
export function AffineContext(props: PropsWithChildren) {
return (
<ProviderComposer
contexts={useMemo(
() =>
[
<Provider key="JotaiProvider" store={rootStore} />,
<ThemeProvider key="ThemeProvider" />,
].filter(Boolean),
[]
)}
>
{props.children}
</ProviderComposer>
);
}