1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +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 NotFound from 'component/common/NotFound/NotFound';
import { ProtectedRoute } from 'component/common/ProtectedRoute/ProtectedRoute'; import { ProtectedRoute } from 'component/common/ProtectedRoute/ProtectedRoute';
import { SWRProvider } from 'component/providers/SWRProvider/SWRProvider'; import { SWRProvider } from 'component/providers/SWRProvider/SWRProvider';
import { PlausibleProvider } from 'component/providers/PlausibleProvider/PlausibleProvider';
import ToastRenderer from 'component/common/ToastRenderer/ToastRenderer'; import ToastRenderer from 'component/common/ToastRenderer/ToastRenderer';
import { routes } from 'component/menu/routes'; import { routes } from 'component/menu/routes';
import { useAuthDetails } from 'hooks/api/getters/useAuth/useAuthDetails'; import { useAuthDetails } from 'hooks/api/getters/useAuth/useAuthDetails';
@ -52,76 +51,64 @@ export const App = () => {
return ( return (
<ErrorBoundary FallbackComponent={LayoutError}> <ErrorBoundary FallbackComponent={LayoutError}>
<PlausibleProvider> <SWRProvider>
<ErrorBoundary FallbackComponent={LayoutError}> <Suspense fallback={<Loader />}>
<SWRProvider> <ConditionallyRender
<Suspense fallback={<Loader />}> condition={!hasFetchedAuth}
<ConditionallyRender show={<Loader />}
condition={!hasFetchedAuth} elseShow={
show={<Loader />} <Demo>
elseShow={ <>
<Demo> <ConditionallyRender
<> condition={Boolean(
<ConditionallyRender uiConfig?.maintenanceMode,
condition={Boolean( )}
uiConfig?.maintenanceMode, show={<MaintenanceBanner />}
)} />
show={<MaintenanceBanner />} <LicenseBanner />
/> <ExternalBanners />
<LicenseBanner /> <InternalBanners />
<ExternalBanners /> <StyledContainer>
<InternalBanners /> <ToastRenderer />
<StyledContainer> <Routes>
<ToastRenderer /> {availableRoutes.map((route) => (
<Routes> <Route
{availableRoutes.map( key={route.path}
(route) => ( path={route.path}
<Route element={
key={route.path} <LayoutPicker
path={ isStandalone={
route.path route.isStandalone ===
} true
element={ }
<LayoutPicker >
isStandalone={ <ProtectedRoute
route.isStandalone === route={route}
true
}
>
<ProtectedRoute
route={
route
}
/>
</LayoutPicker>
}
/> />
), </LayoutPicker>
)} }
<Route />
path='/' ))}
element={ <Route
<InitialRedirect /> path='/'
} element={<InitialRedirect />}
/> />
<Route <Route
path='*' path='*'
element={<NotFound />} element={<NotFound />}
/> />
</Routes> </Routes>
<FeedbackNPS openUrl='http://feedback.unleash.run' /> <FeedbackNPS openUrl='http://feedback.unleash.run' />
<SplashPageRedirect /> <SplashPageRedirect />
</StyledContainer> </StyledContainer>
</> </>
</Demo> </Demo>
} }
/> />
</Suspense> </Suspense>
</SWRProvider> </SWRProvider>
</ErrorBoundary>
</PlausibleProvider>
</ErrorBoundary> </ErrorBoundary>
); );
}; };

View File

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