1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

refactor: move plausible context on top of feedback (#5824)

We were unable to send plausible events from feedback. Now we can.
This commit is contained in:
Jaanus Sellin 2024-01-10 11:31:41 +02:00 committed by GitHub
parent 17fe264632
commit d770f624e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 73 additions and 79 deletions

View File

@ -9,7 +9,6 @@ import Loader from 'component/common/Loader/Loader';
import NotFound from 'component/common/NotFound/NotFound';
import { ProtectedRoute } from 'component/common/ProtectedRoute/ProtectedRoute';
import { SWRProvider } from 'component/providers/SWRProvider/SWRProvider';
import { PlausibleProvider } from 'component/providers/PlausibleProvider/PlausibleProvider';
import ToastRenderer from 'component/common/ToastRenderer/ToastRenderer';
import { routes } from 'component/menu/routes';
import { useAuthDetails } from 'hooks/api/getters/useAuth/useAuthDetails';
@ -52,76 +51,64 @@ export const App = () => {
return (
<ErrorBoundary FallbackComponent={LayoutError}>
<PlausibleProvider>
<ErrorBoundary FallbackComponent={LayoutError}>
<SWRProvider>
<Suspense fallback={<Loader />}>
<ConditionallyRender
condition={!hasFetchedAuth}
show={<Loader />}
elseShow={
<Demo>
<>
<ConditionallyRender
condition={Boolean(
uiConfig?.maintenanceMode,
)}
show={<MaintenanceBanner />}
/>
<LicenseBanner />
<ExternalBanners />
<InternalBanners />
<StyledContainer>
<ToastRenderer />
<Routes>
{availableRoutes.map(
(route) => (
<Route
key={route.path}
path={
route.path
}
element={
<LayoutPicker
isStandalone={
route.isStandalone ===
true
}
>
<ProtectedRoute
route={
route
}
/>
</LayoutPicker>
}
<SWRProvider>
<Suspense fallback={<Loader />}>
<ConditionallyRender
condition={!hasFetchedAuth}
show={<Loader />}
elseShow={
<Demo>
<>
<ConditionallyRender
condition={Boolean(
uiConfig?.maintenanceMode,
)}
show={<MaintenanceBanner />}
/>
<LicenseBanner />
<ExternalBanners />
<InternalBanners />
<StyledContainer>
<ToastRenderer />
<Routes>
{availableRoutes.map((route) => (
<Route
key={route.path}
path={route.path}
element={
<LayoutPicker
isStandalone={
route.isStandalone ===
true
}
>
<ProtectedRoute
route={route}
/>
),
)}
<Route
path='/'
element={
<InitialRedirect />
}
/>
<Route
path='*'
element={<NotFound />}
/>
</Routes>
</LayoutPicker>
}
/>
))}
<Route
path='/'
element={<InitialRedirect />}
/>
<Route
path='*'
element={<NotFound />}
/>
</Routes>
<FeedbackNPS openUrl='http://feedback.unleash.run' />
<FeedbackNPS openUrl='http://feedback.unleash.run' />
<SplashPageRedirect />
</StyledContainer>
</>
</Demo>
}
/>
</Suspense>
</SWRProvider>
</ErrorBoundary>
</PlausibleProvider>
<SplashPageRedirect />
</StyledContainer>
</>
</Demo>
}
/>
</Suspense>
</SWRProvider>
</ErrorBoundary>
);
};

View File

@ -16,7 +16,10 @@ import { AnnouncerProvider } from 'component/common/Announcer/AnnouncerProvider/
import { InstanceStatus } from 'component/common/InstanceStatus/InstanceStatus';
import { UIProviderContainer } from 'component/providers/UIProvider/UIProviderContainer';
import { StickyProvider } from 'component/common/Sticky/StickyProvider';
import { FeedbackProvider } from './component/feedbackNew/FeedbackProvider';
import { FeedbackProvider } from 'component/feedbackNew/FeedbackProvider';
import { PlausibleProvider } from 'component/providers/PlausibleProvider/PlausibleProvider';
import { Error as LayoutError } from './component/layout/Error/Error';
import { ErrorBoundary } from 'react-error-boundary';
window.global ||= window;
@ -27,16 +30,20 @@ ReactDOM.render(
<QueryParamProvider adapter={ReactRouter6Adapter}>
<ThemeProvider>
<AnnouncerProvider>
<FeedbackProvider>
<FeedbackCESProvider>
<StickyProvider>
<InstanceStatus>
<ScrollTop />
<App />
</InstanceStatus>
</StickyProvider>
</FeedbackCESProvider>
</FeedbackProvider>
<ErrorBoundary FallbackComponent={LayoutError}>
<PlausibleProvider>
<FeedbackProvider>
<FeedbackCESProvider>
<StickyProvider>
<InstanceStatus>
<ScrollTop />
<App />
</InstanceStatus>
</StickyProvider>
</FeedbackCESProvider>
</FeedbackProvider>
</PlausibleProvider>
</ErrorBoundary>
</AnnouncerProvider>
</ThemeProvider>
</QueryParamProvider>