From 4418f7c2c42921042c5f0859f27a42edde1b55a5 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Fri, 15 Aug 2025 16:44:11 -0600 Subject: [PATCH] adjusted server side rendering problems --- .../components/features/auth/LoginForm.tsx | 3 --- .../ui/sidebar/SidebarCollapsible.tsx | 24 +++++++++++++++---- .../src/context/Query/QueryProvider.tsx | 2 -- .../assetParamsToRoute.usage.example.tsx | 6 ----- .../acceptsTypeSafeNavigateOptions.ts | 4 +--- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/apps/web-tss/src/components/features/auth/LoginForm.tsx b/apps/web-tss/src/components/features/auth/LoginForm.tsx index 314aaadc8..83055c749 100644 --- a/apps/web-tss/src/components/features/auth/LoginForm.tsx +++ b/apps/web-tss/src/components/features/auth/LoginForm.tsx @@ -36,16 +36,13 @@ export const LoginForm: React.FC<{ redirectTo: string | null | undefined }> = ({ async ({ email, password }: { email: string; password: string }) => { setLoading('email'); try { - console.log('onSignInWithUsernameAndPassword', email, password, redirectTo); const result = await signInWithEmailAndPassword({ data: { email, password, redirectUrl: redirectTo }, }); - console.log('result', result); if (result?.error) { setErrorMessages([result.message]); setLoading(null); } else { - console.log('redirecting to', redirectTo); navigate({ to: redirectTo || '/' }); } } catch (error: unknown) { diff --git a/apps/web-tss/src/components/ui/sidebar/SidebarCollapsible.tsx b/apps/web-tss/src/components/ui/sidebar/SidebarCollapsible.tsx index c32c57501..8d1638786 100644 --- a/apps/web-tss/src/components/ui/sidebar/SidebarCollapsible.tsx +++ b/apps/web-tss/src/components/ui/sidebar/SidebarCollapsible.tsx @@ -129,6 +129,12 @@ export const SidebarCollapsible: React.FC< triggerClassName, className, }) => { + // Track client mount to avoid SSR/CSR hydration mismatches for dnd-kit generated attributes + const [isMounted, setIsMounted] = React.useState(false); + React.useEffect(() => { + setIsMounted(true); + }, []); + const [isOpen, setIsOpen] = React.useState(defaultOpen); const [sortedItems, setSortedItems] = React.useState(items); const [draggingId, setDraggingId] = React.useState(null); @@ -194,9 +200,19 @@ export const SidebarCollapsible: React.FC< )} - -
- {isSortable ? ( + +
+ {isMounted && isSortable ? ( ( diff --git a/apps/web-tss/src/context/Query/QueryProvider.tsx b/apps/web-tss/src/context/Query/QueryProvider.tsx index eaf60a3d2..4354ad5e2 100644 --- a/apps/web-tss/src/context/Query/QueryProvider.tsx +++ b/apps/web-tss/src/context/Query/QueryProvider.tsx @@ -13,8 +13,6 @@ export const QueryPersister = ({ }) => { const [mounted, setMounted] = React.useState(false); - console.log(queryClient.getQueryData(userQueryKeys.favoritesGetList.queryKey)); - return ( (options: OptionsTo): void { +>(_options: OptionsTo): void { // In a test environment, you might want to just log or store the navigation // For actual implementation, you could: // 1. Store the navigation in a test spy // 2. Update window.location in a test environment // 3. Use a mock router's navigate method - // For now, just log it - console.log('Test navigation called with:', options); }