Remove Suspense from root-providers and refine route checks

The Suspense wrapper was removed from root-providers.tsx to simplify code. For the Privacy Path Checking, a property was added to 'AuthRedirectListener' to allow customization of 'privatePathPrefixes', and the prefixes list was moved to the top. Also, explicit constant assertions were added in 'create-i18n-settings.ts' to ensure the types correctness.
This commit is contained in:
giancarlo
2024-04-21 19:53:16 +08:00
parent ae10f7b142
commit 7cbbae9fef
3 changed files with 27 additions and 30 deletions

View File

@@ -1,7 +1,5 @@
'use client';
import { Suspense } from 'react';
import dynamic from 'next/dynamic';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
@@ -46,25 +44,23 @@ export function RootProviders({
return (
<QueryClientProvider client={queryClient}>
<ReactQueryStreamedHydration>
<Suspense fallback={null}>
<I18nProvider settings={i18nSettings} resolver={i18nResolver}>
<CaptchaProvider>
<CaptchaTokenSetter siteKey={captchaSiteKey} />
<I18nProvider settings={i18nSettings} resolver={i18nResolver}>
<CaptchaProvider>
<CaptchaTokenSetter siteKey={captchaSiteKey} />
<AuthChangeListener appHomePath={pathsConfig.app.home}>
<ThemeProvider
attribute="class"
enableSystem
disableTransitionOnChange
defaultTheme={theme}
enableColorScheme={false}
>
{children}
</ThemeProvider>
</AuthChangeListener>
</CaptchaProvider>
</I18nProvider>
</Suspense>
<AuthChangeListener appHomePath={pathsConfig.app.home}>
<ThemeProvider
attribute="class"
enableSystem
disableTransitionOnChange
defaultTheme={theme}
enableColorScheme={false}
>
{children}
</ThemeProvider>
</AuthChangeListener>
</CaptchaProvider>
</I18nProvider>
</ReactQueryStreamedHydration>
</QueryClientProvider>
);