|
@@ -1,4 +1,4 @@
|
|
|
-import React, { ElementType, FC, PropsWithChildren } from 'react'
|
|
|
|
|
|
|
+import React, { FC, PropsWithChildren } from 'react'
|
|
|
import { ChatProvider } from '@/features/chat/context/chat-context'
|
|
import { ChatProvider } from '@/features/chat/context/chat-context'
|
|
|
import { ConnectionProvider } from './connection-context'
|
|
import { ConnectionProvider } from './connection-context'
|
|
|
import { DetachCompileProvider } from '@/shared/context/detach-compile-context'
|
|
import { DetachCompileProvider } from '@/shared/context/detach-compile-context'
|
|
@@ -30,12 +30,6 @@ import { UserFeaturesProvider } from '@/shared/context/user-features-context'
|
|
|
import { UserSettingsProvider } from '@/shared/context/user-settings-context'
|
|
import { UserSettingsProvider } from '@/shared/context/user-settings-context'
|
|
|
import { IdeRedesignSwitcherProvider } from './ide-redesign-switcher-context'
|
|
import { IdeRedesignSwitcherProvider } from './ide-redesign-switcher-context'
|
|
|
import { CommandRegistryProvider } from './command-registry-context'
|
|
import { CommandRegistryProvider } from './command-registry-context'
|
|
|
-import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
|
|
|
|
|
-
|
|
|
|
|
-const rootContextProviders = importOverleafModules('rootContextProviders') as {
|
|
|
|
|
- import: { default: ElementType }
|
|
|
|
|
- path: string
|
|
|
|
|
-}[]
|
|
|
|
|
|
|
|
|
|
export const ReactContextRoot: FC<
|
|
export const ReactContextRoot: FC<
|
|
|
React.PropsWithChildren<{
|
|
React.PropsWithChildren<{
|
|
@@ -77,18 +71,6 @@ export const ReactContextRoot: FC<
|
|
|
...providers,
|
|
...providers,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Extract dynamic providers from modules
|
|
|
|
|
- const dynamicProviders = rootContextProviders.map(
|
|
|
|
|
- module => module.import.default
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
- // Wrap children with all dynamic providers from outside to inside
|
|
|
|
|
- const childrenWrappedWithDynamicProviders =
|
|
|
|
|
- dynamicProviders.reduceRight<React.ReactElement>(
|
|
|
|
|
- (acc, Provider) => <Provider>{acc}</Provider>,
|
|
|
|
|
- <>{children}</>
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
return (
|
|
return (
|
|
|
<Providers.SplitTestProvider>
|
|
<Providers.SplitTestProvider>
|
|
|
<Providers.ModalsContextProvider>
|
|
<Providers.ModalsContextProvider>
|
|
@@ -121,9 +103,7 @@ export const ReactContextRoot: FC<
|
|
|
<Providers.OutlineProvider>
|
|
<Providers.OutlineProvider>
|
|
|
<Providers.IdeRedesignSwitcherProvider>
|
|
<Providers.IdeRedesignSwitcherProvider>
|
|
|
<Providers.CommandRegistryProvider>
|
|
<Providers.CommandRegistryProvider>
|
|
|
- {
|
|
|
|
|
- childrenWrappedWithDynamicProviders
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ {children}
|
|
|
</Providers.CommandRegistryProvider>
|
|
</Providers.CommandRegistryProvider>
|
|
|
</Providers.IdeRedesignSwitcherProvider>
|
|
</Providers.IdeRedesignSwitcherProvider>
|
|
|
</Providers.OutlineProvider>
|
|
</Providers.OutlineProvider>
|