Skip to content

armgit / ente

Public Imported from GitHub
0

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

strictNullChecks prep - 1

Manav Rathi522704ccb868
diff --git a/web/apps/photos/src/components/AuthenticateUser.tsx b/web/apps/photos/src/components/AuthenticateUser.tsx
index a1559f7b83..8c3b813c4c 100644
--- a/web/apps/photos/src/components/AuthenticateUser.tsx
+++ b/web/apps/photos/src/components/AuthenticateUser.tsx
@@ -94,7 +94,7 @@ const AuthenticateUserDialogContents: React.FC<AuthenticateUserProps> = ({
}, [open, validateSession]);
// They'll be read from disk shortly.
- if (!user && !keyAttributes) return <></>;
+ if (!user || !keyAttributes) return <></>;
return (
<VerifyMasterPasswordForm
diff --git a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
index 78d44cba1e..aa1e972358 100644
--- a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
+++ b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
@@ -122,7 +122,7 @@ export const AlbumCastDialogContents: React.FC<AlbumCastDialogProps> = ({
log.error("Error requesting session", e);
return;
}
- const session = instance.getCurrentSession();
+ const session = instance.getCurrentSession()!;
session.addMessageListener(
"urn:x-cast:pair-request",
(_, message) => {
diff --git a/web/apps/photos/src/components/Collections/AllAlbums.tsx b/web/apps/photos/src/components/Collections/AllAlbums.tsx
index 80c589a0a8..e0b6bf710f 100644
--- a/web/apps/photos/src/components/Collections/AllAlbums.tsx
+++ b/web/apps/photos/src/components/Collections/AllAlbums.tsx
@@ -170,7 +170,7 @@ const AlbumsRow = React.memo(
isScrolling,
}: ListChildComponentProps<ItemData>) => {
const { collectionRowList, onCollectionClick } = data;
- const collectionRow = collectionRowList[index];
+ const collectionRow = collectionRowList[index]!;
return (
<div style={style}>
<Stack direction="row" sx={{ p: 2, gap: 0.5 }}>
@@ -191,7 +191,7 @@ const AlbumsRow = React.memo(
interface AllAlbumsContentProps {
collectionSummaries: CollectionSummary[];
- onCollectionClick: (id?: number) => void;
+ onCollectionClick: (id: number) => void;
}
const AllAlbumsContent: React.FC<AllAlbumsContentProps> = ({
@@ -203,7 +203,9 @@ const AllAlbumsContent: React.FC<AllAlbumsContentProps> = ({
const refreshInProgress = useRef(false);
const shouldRefresh = useRef(false);
- const [collectionRowList, setCollectionRowList] = useState([]);
+ const [collectionRowList, setCollectionRowList] = useState<
+ CollectionSummary[][]
+ >([]);
const columns = isTwoColumn ? 2 : 3;
const maxListContentHeight =
@@ -231,7 +233,7 @@ const AllAlbumsContent: React.FC<AllAlbumsContentProps> = ({
i < columns && index < collectionSummaries.length;
i++
) {
- collectionRow.push(collectionSummaries[index++]);
+ collectionRow.push(collectionSummaries[index++]!);
}
collectionRowList.push(collectionRow);
}
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
index 25a44db6eb..df35d1b372 100644
--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
@@ -124,7 +124,7 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({
}) => {
const { showMiniDialog, onGenericError } = useBaseContext();
const { showLoadingBar, hideLoadingBar } = usePhotosAppContext();
- const overflowMenuIconRef = useRef<SVGSVGElement>(null);
+ const overflowMenuIconRef = useRef<SVGSVGElement | null>(null);
const { show: showSortOrderMenu, props: sortOrderMenuVisibilityProps } =
useModalVisibility();
@@ -674,7 +674,7 @@ const DownloadOption: React.FC<
interface CollectionSortOrderMenuProps {
open: boolean;
onClose: () => void;
- overflowMenuIconRef: React.RefObject<SVGSVGElement>;
+ overflowMenuIconRef: React.RefObject<SVGSVGElement | null>;
onAscClick: () => void;
onDescClick: () => void;
}
@@ -699,7 +699,7 @@ const CollectionSortOrderMenu: React.FC<CollectionSortOrderMenuProps> = ({
return (
<Menu
id="collection-files-sort"
- anchorEl={overflowMenuIconRef.current}
+ anchorEl={overflowMenuIconRef?.current}
open={open}
onClose={onClose}
slotProps={{