chore: optimize tests (#2280)

This commit is contained in:
David Nguyen
2025-12-06 12:59:53 +11:00
committed by GitHub
parent 9238f759a6
commit f80aa4bf72
18 changed files with 357 additions and 176 deletions
+16 -2
View File
@@ -46,12 +46,16 @@ export async function loader({ request }: Route.LoaderArgs) {
const { getTheme } = await themeSessionResolver(request);
let lang: SupportedLanguageCodes = await langCookie.parse(request.headers.get('cookie') ?? '');
const cookieHeader = request.headers.get('cookie') ?? '';
let lang: SupportedLanguageCodes = await langCookie.parse(cookieHeader);
if (!APP_I18N_OPTIONS.supportedLangs.includes(lang)) {
lang = extractLocaleData({ headers: request.headers }).lang;
}
const disableAnimations = cookieHeader.includes('__disable_animations=true');
let organisations = null;
if (session.isAuthenticated) {
@@ -62,6 +66,7 @@ export async function loader({ request }: Route.LoaderArgs) {
{
lang,
theme: getTheme(),
disableAnimations,
session: session.isAuthenticated
? {
user: session.user,
@@ -92,7 +97,8 @@ export function Layout({ children }: { children: React.ReactNode }) {
}
export function LayoutContent({ children }: { children: React.ReactNode }) {
const { publicEnv, session, lang, ...data } = useLoaderData<typeof loader>() || {};
const { publicEnv, session, lang, disableAnimations, ...data } =
useLoaderData<typeof loader>() || {};
const [theme] = useTheme();
@@ -111,6 +117,14 @@ export function LayoutContent({ children }: { children: React.ReactNode }) {
<meta name="google" content="notranslate" />
<PreventFlashOnWrongTheme ssrTheme={Boolean(data.theme)} />
{disableAnimations && (
<style
dangerouslySetInnerHTML={{
__html: `*, *::before, *::after { animation: none !important; transition: none !important; }`,
}}
/>
)}
{/* Fix: https://stackoverflow.com/questions/21147149/flash-of-unstyled-content-fouc-in-firefox-only-is-ff-slow-renderer */}
<script>0</script>
</head>
@@ -28,8 +28,6 @@ export const loader = () => {
export default function TeamsSettingsPage() {
const { isAiFeaturesConfigured } = useLoaderData<typeof loader>();
console.log('isAiFeaturesConfigured', isAiFeaturesConfigured);
const team = useCurrentTeam();
const { t } = useLingui();