Rewrite the restricted iterators and reorder the forward references. [skip build]
This commit is contained in:
@@ -196,6 +196,14 @@ function ProfileBanner({
|
||||
}
|
||||
}, [presence?.status, isEditingStatus]);
|
||||
|
||||
// Avatar-specific upload
|
||||
const [avatarFile, setAvatarFile] = useState<File>();
|
||||
const avatarUploadAtom = useMemo(() => {
|
||||
if (avatarFile) return createUploadAtom(avatarFile);
|
||||
return undefined;
|
||||
}, [avatarFile]);
|
||||
const pickAvatarFile = useFilePicker(setAvatarFile, false);
|
||||
|
||||
const handleAvatarClick = () => {
|
||||
pickAvatarFile('image/*');
|
||||
};
|
||||
@@ -336,14 +344,6 @@ function ProfileBanner({
|
||||
|
||||
const pickFile = useFilePicker(setImageFile, false);
|
||||
|
||||
// Avatar-specific upload
|
||||
const [avatarFile, setAvatarFile] = useState<File>();
|
||||
const avatarUploadAtom = useMemo(() => {
|
||||
if (avatarFile) return createUploadAtom(avatarFile);
|
||||
return undefined;
|
||||
}, [avatarFile]);
|
||||
const pickAvatarFile = useFilePicker(setAvatarFile, false);
|
||||
|
||||
// Warn before leaving when an upload or save is in progress
|
||||
useEffect(() => {
|
||||
if (!imageFile && !avatarFile && !saving) return undefined;
|
||||
|
||||
Reference in New Issue
Block a user