Simplify loading guard
cgen-12bbd70826b54f0fb9f30e1bc496a8fe
This commit is contained in:
parent
b286e5afc0
commit
4836d6cc37
1 changed files with 1 additions and 27 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue