Skip to content

Commit 6e05ecf

Browse files
debug: add more detailed component rendering logs to track routing flow
1 parent b683797 commit 6e05ecf

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { useEffect } from 'react';
2+
import { Navigate } from 'react-router-dom';
3+
4+
export function DebugDefaultRoute() {
5+
useEffect(() => {
6+
console.log('DebugDefaultRoute: Default route hit, redirecting to /my-data');
7+
}, []);
8+
9+
return <Navigate to="/my-data" replace />;
10+
}

src/layouts/ConnectWallet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Button } from '@/components/ui/button';
33
import { useLoginLogout } from '@/hooks/useLoginLogout';
44

55
export default function ConnectWallet() {
6+
console.log('ConnectWallet: Component rendering...');
67
const { login } = useLoginLogout();
78

89
return (

src/layouts/MainLayout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import ConnectWallet from './ConnectWallet.tsx';
99
import { DebugRouter } from '@/components/DebugRouter.tsx';
1010

1111
export default function MainLayout() {
12+
console.log('MainLayout: Component rendering...');
1213
useWatchAccount();
1314
const { isConnected } = useUserStore();
15+
console.log('MainLayout: isConnected =', isConnected);
1416

1517
return (
1618
<div className="flex">

src/router.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import Resources from '@/views/resources';
2-
import { createBrowserRouter, Navigate } from 'react-router-dom';
2+
import { createBrowserRouter } from 'react-router-dom';
33
import MainLayout from './layouts/MainLayout.tsx';
44
import ContactList from './views/contact/contactList.tsx';
55
import SendMessage from './views/contact/sendMessage.tsx';
66
import AddProtectedData from './views/myData/addProtectedData.tsx';
77
import ProtectedData from './views/myData/protectedData.tsx';
88
import ProtectedDataList from './views/myData/protectedDataList.tsx';
9+
import { DebugDefaultRoute } from '@/components/DebugDefaultRoute.tsx';
910

1011
export const router = createBrowserRouter(
1112
[
@@ -15,7 +16,7 @@ export const router = createBrowserRouter(
1516
{
1617
index: true,
1718
path: '*',
18-
element: <Navigate to="/my-data" replace />,
19+
element: <DebugDefaultRoute />,
1920
},
2021
{
2122
path: '/my-data',

0 commit comments

Comments
 (0)