Skip to content

Commit d0eb769

Browse files
multi: wrap entry points with PlatformProvider
AppEntry and AppCockpit now inject their respective platform objects into the React tree so all descendants can access the correct hooks via usePlatform() instead of build-time switching. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b1fcca7 commit d0eb769

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/AppCockpit.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { HashRouter } from 'react-router-dom';
1212

1313
import './AppCockpit.scss';
1414
import { NotReady, RequireAdmin } from './Components/Cockpit';
15+
import { PlatformProvider } from './context/platform';
16+
import { onPremPlatform } from './context/platform/onprem';
1517
import { Router } from './Router';
1618
import { onPremStore as store } from './store';
1719
import { useGetComposerSocketStatus } from './Utilities/useComposerStatus';
@@ -41,11 +43,13 @@ const Application = () => {
4143
};
4244
const ImageBuilder = () => (
4345
<Provider store={store}>
44-
<Page className='no-masthead-sidebar' isContentFilled>
45-
<PageSection>
46-
<Application />
47-
</PageSection>
48-
</Page>
46+
<PlatformProvider value={onPremPlatform}>
47+
<Page className='no-masthead-sidebar' isContentFilled>
48+
<PageSection>
49+
<Application />
50+
</PageSection>
51+
</Page>
52+
</PlatformProvider>
4953
</Provider>
5054
);
5155

src/AppEntry.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ import React from 'react';
33
import { Provider } from 'react-redux';
44

55
import App from './App';
6+
import { PlatformProvider } from './context/platform';
7+
import { hostedPlatform } from './context/platform/hosted';
68
import { serviceStore as store } from './store';
79

810
const ImageBuilder = () => (
911
<Provider store={store}>
10-
<App />
12+
<PlatformProvider value={hostedPlatform}>
13+
<App />
14+
</PlatformProvider>
1115
</Provider>
1216
);
1317

0 commit comments

Comments
 (0)