Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

exhaustive deps

Manav Rathibfd0bc116daa
diff --git a/web/apps/photos/eslint.config.mjs b/web/apps/photos/eslint.config.mjs
index c4e97c3d6a..a1fe1f9296 100644
--- a/web/apps/photos/eslint.config.mjs
+++ b/web/apps/photos/eslint.config.mjs
@@ -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"] }];
diff --git a/web/apps/photos/src/components/AuthenticateUser.tsx b/web/apps/photos/src/components/AuthenticateUser.tsx
index 8c3b813c4c..2fabc25d89 100644
--- a/web/apps/photos/src/components/AuthenticateUser.tsx
+++ b/web/apps/photos/src/components/AuthenticateUser.tsx
@@ -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());
diff --git a/web/apps/photos/src/components/Avatar.tsx b/web/apps/photos/src/components/Avatar.tsx
index 866c11fdc6..05feac15bf 100644
--- a/web/apps/photos/src/components/Avatar.tsx
+++ b/web/apps/photos/src/components/Avatar.tsx
@@ -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";
diff --git a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
index d81658cac5..672ab6b9ba 100644
--- a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
+++ b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
@@ -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
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx
index 9679f04c04..e22740e1eb 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx
@@ -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);
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
index b6be9a1ad9..ae6f126397 100644
--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
@@ -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,
diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsx
index 9bc755283f..b419a81296 100644
--- a/web/apps/photos/src/components/FileList.tsx
+++ b/web/apps/photos/src/components/FileList.tsx
@@ -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(
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsx
index df253a1a62..ab08d4c27c 100644
--- a/web/apps/photos/src/components/FileListWithViewer.tsx
+++ b/web/apps/photos/src/components/FileListWithViewer.tsx
@@ -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(),
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx
index ed2ee646e4..8c9769d0c5 100644
--- a/web/apps/photos/src/components/Sidebar.tsx
+++ b/web/apps/photos/src/components/Sidebar.tsx
@@ -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 (
<>
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index 1626d770df..e43e1f2867 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -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";
diff --git a/web/apps/photos/src/components/WatchFolder.tsx b/web/apps/photos/src/components/WatchFolder.tsx
index 164db56c89..fd7627b30a 100644
--- a/web/apps/photos/src/components/WatchFolder.tsx
+++ b/web/apps/photos/src/components/WatchFolder.tsx
@@ -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 (
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index ae009c7ec8..018e98efbb 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -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(
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 81b8bd509e..5e1437d64b 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -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";
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 911d48e312..bd65bc12f4 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -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(() => {
diff --git a/web/packages/new/README.md b/web/packages/new/README.md
index 5e375b7597..820f68831f 100644
--- a/web/packages/new/README.md
+++ b/web/packages/new/README.md
@@ -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