Made more client components to make the rendering not so crazy
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
||||
getSignedUrl,
|
||||
getUser,
|
||||
updateProfile as updateProfileAction,
|
||||
} from '@/lib/actions';
|
||||
} from '@/lib/hooks';
|
||||
import {
|
||||
type User,
|
||||
type Profile,
|
||||
@@ -119,7 +119,7 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
|
||||
};
|
||||
}, [fetchUserData]);
|
||||
|
||||
const updateProfile = async (data: {
|
||||
const updateProfile = useCallback(async (data: {
|
||||
full_name?: string;
|
||||
email?: string;
|
||||
avatar_url?: string;
|
||||
@@ -151,15 +151,12 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
|
||||
console.error('Error updating profile:', error);
|
||||
toast.error(error instanceof Error ? error.message : 'Failed to update profile');
|
||||
return { success: false, error };
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
const refreshUserData = async () => {
|
||||
console.log('Manual refresh triggered');
|
||||
const refreshUserData = useCallback(async () => {
|
||||
await fetchUserData();
|
||||
};
|
||||
}, [fetchUserData]);
|
||||
|
||||
const value = {
|
||||
user,
|
||||
@@ -171,7 +168,11 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
|
||||
refreshUserData,
|
||||
};
|
||||
|
||||
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
|
||||
return (
|
||||
<AuthContext.Provider value={value}>
|
||||
{children}
|
||||
</AuthContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export const useAuth = () => {
|
||||
|
||||
Reference in New Issue
Block a user