Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useEffect #82

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ export default function HomePage() {
const supabase = createClientComponentClient<Database>();
const [user, setUser] = useState<null | User>(null);

useEffect(() => {
if (!isSessionLoading && !session) {
push('/auth');
}
if (!isSessionLoading && session) {
getUserFromSupabase(session, supabase, setUser);
}
}, [isSessionLoading, session]);
// useEffect(() => {
// if (!isSessionLoading && !session) {
// push('/auth');
// }
// if (!isSessionLoading && session) {
// getUserFromSupabase(session, supabase, setUser);
// }
// }, [isSessionLoading, session]);
Comment on lines +17 to +24
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useEffect hook here is crucial for redirecting the user to the '/auth' page if there is no session and for fetching the user data from Supabase if there is a session. By commenting out this hook, these functionalities are lost. This could lead to unauthorized access to the home page and the user data not being fetched. I suggest uncommenting this block of code.


return (
<Page pageTitle="Home" user={user}>
Expand Down