Simplify loading guard

cgen-12bbd70826b54f0fb9f30e1bc496a8fe
This commit is contained in:
Builder.io 2025-10-05 01:45:20 +00:00
parent b286e5afc0
commit 4836d6cc37

View file

@ -95,33 +95,7 @@ const ProfilePassport = () => {
let cancelled = false;
const profileMatchesCurrentTarget = (() => {
if (!profile) {
return false;
}
if (normalizedUsername) {
return (
profile.username?.toLowerCase() === normalizedUsername ||
profile.id === requestedUsername
);
}
if (isSelfRoute) {
if (user?.id && profile.id === user.id) {
return true;
}
if (
authProfile?.username &&
profile.username &&
authProfile.username.toLowerCase() ===
profile.username.toLowerCase()
) {
return true;
}
}
return false;
})();
if (!profileMatchesCurrentTarget) {
if (!targetKey || lastLoadedKeyRef.current !== targetKey) {
setLoading(true);
}