Authentication check every click
Why that always that i click on screen the 'me' request is being done?
/auth/me endpoint. This behavior is part of Wasp's built-in authentication flow, but the exact reason for checking on every click is not explicitly stated in the given information./auth/me endpoint is used to retrieve the user's profile and check if they are authenticated Github Issue./auth/me request is made on every click. For a more detailed explanation or to discuss potential optimizations, you may want to reach out to the Wasp community or create an issue on their GitHub repository.
/auth/me/auth/me/auth/meexport default function App() {
const location = useLocation();
const navigate = useNavigate();
const excludedPaths = useMemo(() => ({
exact: ['/', '/login', ],
prefixes: ['/blog', ]
}), []);
const isPublicRoute = useMemo(() => {
return excludedPaths.exact.includes(location.pathname) ||
excludedPaths.prefixes.some(prefix => location.pathname.startsWith(prefix));
}, [location.pathname, excludedPaths]);
// Always call useAuth, but ignore its data for public routes
const { data: user } = useAuth();
const effectiveUser = isPublicRoute ? null : user;