exhaustive deps

This commit is contained in:
Manav Rathi
2025-07-08 16:09:22 +05:30
parent ae28125a7a
commit bfd0bc116d
15 changed files with 33 additions and 31 deletions

View File

@@ -1,16 +1,3 @@
import config from "ente-build-config/eslintrc-next-app.mjs";
export default [
...config,
{ ignores: [".next-desktop"] },
{
rules: {
/* TODO:
* "This rule requires the `strictNullChecks` compiler option to be
* turned on to function correctly"
*/
/** TODO: Disabled as we migrate, try to prune these again */
"react-hooks/exhaustive-deps": "off",
},
},
];
export default [...config, { ignores: [".next-desktop"] }];

View File

@@ -80,7 +80,7 @@ const AuthenticateUserDialogContents: React.FC<AuthenticateUserProps> = ({
// potentially transient issues.
log.warn("Ignoring error when determining session validity", e);
}
}, [logout, showMiniDialog]);
}, [logout, showMiniDialog, onClose]);
useEffect(() => {
setUser(ensureLocalUser());

View File

@@ -1,3 +1,5 @@
// TODO: Audit this file
/* eslint-disable react-hooks/exhaustive-deps */
import { styled } from "@mui/material";
import type { LocalUser } from "ente-accounts/services/user";
import log from "ente-base/log";

View File

@@ -152,7 +152,7 @@ export const AlbumCastDialogContents: React.FC<AlbumCastDialogProps> = ({
});
});
}
}, [view, collection]);
}, [onClose, view, collection]);
useEffect(() => {
// Make API call to clear all previous sessions (if any) whenever the

View File

@@ -497,7 +497,7 @@ const AddParticipant: React.FC<AddParticipantProps> = ({
email != user.email &&
!collection?.sharees?.find((value) => value.email == email),
);
}, [shareSuggestionEmails, collection.sharees]);
}, [user.email, shareSuggestionEmails, collection.sharees]);
const handleRootClose = () => {
onClose();
@@ -1130,7 +1130,7 @@ const PublicShare: React.FC<PublicShareProps> = ({
} else {
setResolvedURL(undefined);
}
}, [publicURL]);
}, [collection.key, publicURL]);
const handleCopyLink = () => {
if (resolvedURL) void navigator.clipboard.writeText(resolvedURL);

View File

@@ -1,3 +1,4 @@
// TODO: Audit this file
import { AllAlbums } from "components/Collections/AllAlbums";
import {
CollectionShare,
@@ -161,6 +162,7 @@ export const GalleryBarAndListHeader: React.FC<
),
height: 68,
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
shouldHide,
mode,

View File

@@ -288,6 +288,8 @@ export const FileList: React.FC<FileListProps> = ({
}
setTimeStampList(timeStampList);
// TODO:
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
width,
height,
@@ -510,6 +512,8 @@ export const FileList: React.FC<FileListProps> = ({
localSelectedDates.forEach((date) => checked.add(date));
return checked;
});
// TODO:
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selected]);
const handleSelectMulti = handleSelectCreatorMulti(

View File

@@ -138,12 +138,12 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
setCurrentIndex(index);
setOpenFileViewer(true);
onSetOpenFileViewer?.(true);
}, []);
}, [onSetOpenFileViewer]);
const handleCloseFileViewer = useCallback(() => {
onSetOpenFileViewer?.(false);
setOpenFileViewer(false);
}, []);
}, [onSetOpenFileViewer]);
const handleTriggerRemotePull = useCallback(
() => void onRemotePull(),

View File

@@ -348,7 +348,7 @@ const SubscriptionStatus: React.FC<SubscriptionStatusProps> = ({
}
}
},
[userDetails],
[onShowPlanSelector, userDetails],
);
if (!hasAMessage) {
@@ -651,13 +651,13 @@ const ExitSection: React.FC = () => {
};
const InfoSection: React.FC = () => {
const [appVersion, setAppVersion] = useState<string | undefined>();
const [host, setHost] = useState<string | undefined>();
const [appVersion, setAppVersion] = useState("");
const [host, setHost] = useState<string | undefined>("");
useEffect(() => {
void globalThis.electron?.appVersion().then(setAppVersion);
void customAPIHost().then(setHost);
});
}, []);
return (
<>

View File

@@ -1,5 +1,6 @@
// TODO: Too many null assertions in this file. The types need reworking.
// TODO: Audit this file
// TODO: Too many null assertions in this file. The types need reworking.
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable @typescript-eslint/no-misused-promises */
/* eslint-disable @typescript-eslint/no-floating-promises */
import ChevronRightIcon from "@mui/icons-material/ChevronRight";

View File

@@ -72,6 +72,8 @@ export const WatchFolder: React.FC<ModalVisibilityProps> = ({
return () => {
removeEventListener("drop", handleWatchFolderDrop);
};
// TODO:
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]);
const selectCollectionMappingAndAddWatchIfDirectory = async (

View File

@@ -122,7 +122,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
electron.onOpenEnteURL(undefined);
electron.onAppUpdateAvailable(undefined);
};
}, []);
}, [router, showMiniDialog, showNotification]);
useEffect(() => {
if (isDesktop) void resumeExportsIfNeeded();
@@ -152,6 +152,8 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
throw "Aborting route change, redirection in process....";
}
});
// TODO:
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const baseContext = useMemo(

View File

@@ -1,5 +1,6 @@
// TODO: Audit this file (the code here is mostly fine, but needs revisiting
// the file it depends on have been audited and their interfaces fixed).
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable @typescript-eslint/no-floating-promises */
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import FileUploadOutlinedIcon from "@mui/icons-material/FileUploadOutlined";

View File

@@ -213,6 +213,8 @@ export default function PublicCollectionGallery() {
}
};
main();
// TODO:
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const downloadEnabled =
@@ -313,7 +315,7 @@ export default function PublicCollectionGallery() {
hideLoadingBar();
setLoading(false);
}
}, [showLoadingBar, hideLoadingBar]);
}, [showLoadingBar, hideLoadingBar, onGenericError]);
// See: [Note: Visual feedback to acknowledge user actions]
const handleVisualFeedback = useCallback(() => {

View File

@@ -1,9 +1,8 @@
## ente-new
This package only exists so that we can write code that works with TypeScript
strict mode. This provides a gradual way of migrating the existing apps code to
strict mode. Once there is sufficient gravity here, we can flip the switch and
move these back to where they came from.
This package is only transient. Once the remaining files in apps/photos have
been revisited for clarity, and the albums app has been split into a separate
folder, this package will not exist.
### Packaging