diff --git a/packages/react/src/client.js b/packages/react/src/client.js index 50ce68b..fd7393a 100644 --- a/packages/react/src/client.js +++ b/packages/react/src/client.js @@ -15,12 +15,17 @@ export default { ), ); const Providers = await latus.invokeOrdered('@latus/react/providers'); + const FlattenedProviders = []; + for (let i = 0; i < Providers.length; i++) { + const Provider = Providers[i]; + FlattenedProviders.push(...(Array.isArray(Provider[0]) ? Provider : [Provider])); + } const RootComponent = () => { const children = Object.entries(Components) .map(([key, Component]) => React.createElement(Component, {key})); const RootElements = [ [LatusContext.Provider, {value: latus}], - ].concat(Providers) + ].concat(FlattenedProviders) .reverse() .reduce((children, [Provider, props], i) => [ // eslint-disable-next-line react/no-array-index-key