Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Implement error handling for zip file uploads (#10362)

Arno DUBOIS23f69cce6e06
diff --git a/desktop/CHANGELOG.md b/desktop/CHANGELOG.md
index 2ae4365728..d0cf204471 100644
--- a/desktop/CHANGELOG.md
+++ b/desktop/CHANGELOG.md
@@ -2,6 +2,7 @@
## v1.7.25 (unreleased)
+- Show files skipped during upload (hidden files and unreadable zips) in the upload progress.
- Support Traditional Chinese and Urdu translations.
## v1.7.24
diff --git a/desktop/src/main/services/upload.ts b/desktop/src/main/services/upload.ts
index f62a181a48..0cd93bc6e7 100644
--- a/desktop/src/main/services/upload.ts
+++ b/desktop/src/main/services/upload.ts
@@ -1,29 +1,42 @@
import fs from "node:fs/promises";
import path from "node:path";
import { existsSync } from "original-fs";
-import type { PendingUploads, ZipItem } from "../../types/ipc";
+import type { PendingUploads, SkippedFile, ZipItem } from "../../types/ipc";
import log from "../log";
import { uploadStatusStore } from "../stores/upload-status";
import { clearOpenZipCache, markClosableZip, openZip } from "./zip";
-export const listZipItems = async (zipPath: string): Promise<ZipItem[]> => {
- const zip = openZip(zipPath);
-
+export const listZipItems = async (
+ zipPath: string,
+): Promise<{ items: ZipItem[]; skippedFiles: SkippedFile[] }> => {
try {
- const entries = await zip.entries();
- const entryNames: string[] = [];
-
- for (const entry of Object.values(entries)) {
- const basename = path.basename(entry.name);
- // Ignore "hidden" files (files whose names begins with a dot).
- if (entry.isFile && !basename.startsWith(".")) {
- // `entry.name` is the path within the zip.
- entryNames.push(entry.name);
+ const zip = openZip(zipPath);
+ try {
+ const entries = await zip.entries();
+ const items: ZipItem[] = [];
+ const skippedFiles: SkippedFile[] = [];
+
+ for (const entry of Object.values(entries)) {
+ if (!entry.isFile) continue;
+
+ const basename = path.basename(entry.name);
+ if (basename.startsWith(".")) {
+ skippedFiles.push({ name: entry.name, type: "hiddenFile" });
+ continue;
+ }
+ items.push([zipPath, entry.name]);
}
+
+ return { items, skippedFiles };
+ } finally {
+ markClosableZip(zipPath);
}
- return entryNames.map((entryName) => [zipPath, entryName]);
- } finally {
- markClosableZip(zipPath);
+ } catch (e) {
+ log.error("Ignoring malformed zip", e);
+ return {
+ items: [],
+ skippedFiles: [{ name: path.basename(zipPath), type: "failedZip" }],
+ };
}
};
@@ -56,7 +69,8 @@ export const pendingUploads = async (): Promise<PendingUploads | undefined> => {
const filePaths = allFilePaths.filter((f) => existsSync(f));
const allZipItems = uploadStatusStore.get("zipItems");
- let zipItems: typeof allZipItems;
+ let zipItems: ZipItem[] = [];
+ let skippedFiles: SkippedFile[] = [];
// Migration code - May 2024. Remove after a bit (tag: Migration).
//
@@ -70,21 +84,19 @@ export const pendingUploads = async (): Promise<PendingUploads | undefined> => {
if (allZipItems === undefined) {
const allZipPaths = uploadStatusStore.get("zipPaths") ?? [];
const zipPaths = allZipPaths.filter((f) => existsSync(f));
- zipItems = [];
for (const zip of zipPaths) {
- try {
- zipItems = zipItems.concat(await listZipItems(zip));
- } catch (e) {
- log.error("Ignoring items in malformed zip", e);
- }
+ const result = await listZipItems(zip);
+ zipItems = zipItems.concat(result.items);
+ skippedFiles = skippedFiles.concat(result.skippedFiles);
}
} else {
zipItems = allZipItems.filter(([z]) => existsSync(z));
+ skippedFiles = uploadStatusStore.get("skippedFiles") ?? [];
}
if (filePaths.length == 0 && zipItems.length == 0) return undefined;
- return { collectionName, filePaths, zipItems };
+ return { collectionName, filePaths, zipItems, skippedFiles };
};
/**
@@ -127,11 +139,13 @@ export const setPendingUploads = ({
collectionName,
filePaths,
zipItems,
+ skippedFiles,
}: PendingUploads) => {
uploadStatusStore.set({
collectionName: collectionName ?? "",
filePaths: filePaths,
zipItems: zipItems,
+ skippedFiles: skippedFiles ?? [],
});
};
diff --git a/desktop/src/main/stores/upload-status.ts b/desktop/src/main/stores/upload-status.ts
index 09b3889cca..07e41f6cbe 100644
--- a/desktop/src/main/stores/upload-status.ts
+++ b/desktop/src/main/stores/upload-status.ts
@@ -1,4 +1,5 @@
import Store, { Schema } from "electron-store";
+import type { SkippedFile, ZipItem } from "../../types/ipc";
export interface UploadStatusStore {
/**
@@ -14,11 +15,16 @@ export interface UploadStatusStore {
/**
* Each item is the path to a zip file and the name of an entry within it.
*/
- zipItems?: [zipPath: string, entryName: string][];
+ zipItems?: ZipItem[];
/**
* @deprecated Legacy paths to zip files, now subsumed into zipItems.
*/
zipPaths?: string[];
+ /**
+ * Files that were skipped because either we could not open them (zip files)
+ * or they are hidden dot files.
+ */
+ skippedFiles?: SkippedFile[];
}
const uploadStatusSchema: Schema<UploadStatusStore> = {
@@ -29,6 +35,17 @@ const uploadStatusSchema: Schema<UploadStatusStore> = {
items: { type: "array", items: { type: "string" } },
},
zipPaths: { type: "array", items: { type: "string" } },
+ skippedFiles: {
+ type: "array",
+ items: {
+ type: "object",
+ required: ["name", "type"],
+ properties: {
+ name: { type: "string" },
+ type: { type: "string", enum: ["hiddenFile", "failedZip"] },
+ },
+ },
+ },
};
export const uploadStatusStore = new Store({
diff --git a/desktop/src/types/ipc.ts b/desktop/src/types/ipc.ts
index 2c4de053bd..7de8784c64 100644
--- a/desktop/src/types/ipc.ts
+++ b/desktop/src/types/ipc.ts
@@ -78,10 +78,16 @@ export interface FolderWatchSyncedFile {
export type ZipItem = [zipPath: string, entryName: string];
+export interface SkippedFile {
+ name: string;
+ type: "hiddenFile" | "failedZip";
+}
+
export interface PendingUploads {
collectionName: string | undefined;
filePaths: string[];
zipItems: ZipItem[];
+ skippedFiles?: SkippedFile[];
}
export type FFmpegCommand = string[] | { default: string[]; hdr: string[] };
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index fc09920b3c..ee920a6930 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -33,7 +33,12 @@ import {
import { useBaseContext } from "ente-base/context";
import { basename, dirname, joinPath } from "ente-base/file-name";
import log from "ente-base/log";
-import type { CollectionMapping, Electron, ZipItem } from "ente-base/types/ipc";
+import type {
+ CollectionMapping,
+ Electron,
+ SkippedFile,
+ ZipItem,
+} from "ente-base/types/ipc";
import { type UploadTypeSelectorIntent } from "ente-gallery/components/Upload";
import { UploadProgress } from "ente-gallery/components/UploadProgress";
import { useFileInput } from "ente-gallery/components/utils/use-file-input";
@@ -246,6 +251,8 @@ export const Upload: React.FC<UploadProps> = ({
*/
const [desktopZipItems, setDesktopZipItems] = useState<ZipItem[]>([]);
+ const [skippedFiles, setSkippedFiles] = useState<SkippedFile[]>([]);
+
/**
* Consolidated and cleaned list obtained from {@link webFiles},
* {@link desktopFiles}, {@link desktopFilePaths} and
@@ -397,7 +404,8 @@ export const Upload: React.FC<UploadProps> = ({
electron.pendingUploads().then((pending) => {
if (!pending) return;
- const { collectionName, filePaths, zipItems } = pending;
+ const { collectionName, filePaths, zipItems, skippedFiles } =
+ pending;
log.info(
`Resuming pending of upload of ${filePaths.length + zipItems.length} items${collectionName ? " to collection " + collectionName : ""}`,
@@ -406,6 +414,7 @@ export const Upload: React.FC<UploadProps> = ({
pendingDesktopUploadCollectionName.current = collectionName;
setDesktopFilePaths(filePaths);
setDesktopZipItems(zipItems);
+ setSkippedFiles(skippedFiles ?? []);
});
}
}, []);
@@ -437,12 +446,14 @@ export const Upload: React.FC<UploadProps> = ({
if (electron) {
desktopFilesAndZipItems(electron, files).then(
- ({ fileAndPaths, zipItems }) => {
+ ({ fileAndPaths, zipItems, skippedFiles }) => {
setDesktopFiles(fileAndPaths);
setDesktopZipItems(zipItems);
+ setSkippedFiles(skippedFiles);
},
);
} else {
+ setSkippedFiles([]);
setWebFiles(files);
}
}, [selectedInputFiles, dragAndDropFiles]);
@@ -479,7 +490,26 @@ export const Upload: React.FC<UploadProps> = ({
desktopZipItems.map((ze) => [ze, joinPath(dirname(ze[0]), ze[1])]),
].flat() as UploadItemAndPath[];
- if (allItemAndPaths.length == 0) return;
+ const hiddenFiles: SkippedFile[] = [];
+ const prunedItemAndPaths = allItemAndPaths.filter(([, p]) => {
+ const name = basename(p);
+ if (name.startsWith(".")) {
+ hiddenFiles.push({ name, type: "hiddenFile" });
+ return false;
+ }
+ return true;
+ });
+ const nextSkippedFiles = skippedFiles.concat(hiddenFiles);
+ if (hiddenFiles.length > 0) setSkippedFiles(nextSkippedFiles);
+
+ if (prunedItemAndPaths.length == 0) {
+ if (nextSkippedFiles.length > 0 && !uploadRunning.current) {
+ uploadManager.prepareForNewUpload();
+ setUploadPhase("done");
+ uploadManager.showUploadProgressDialog();
+ }
+ return;
+ }
if (uploadManager.isUploadRunning()) {
if (watcher.isUploadRunning()) {
@@ -510,16 +540,7 @@ export const Upload: React.FC<UploadProps> = ({
setDesktopFilePaths([]);
setDesktopZipItems([]);
- // Filter out files whose names begins with a ".".
- const prunedItemAndPaths = allItemAndPaths.filter(
- ([, p]) => !basename(p).startsWith("."),
- );
-
uploadItemsAndPaths.current = prunedItemAndPaths;
- if (uploadItemsAndPaths.current.length == 0) {
- props.setLoading(false);
- return;
- }
const importSuggestion = deriveImportSuggestion(
selectedUploadType.current,
@@ -812,6 +833,7 @@ export const Upload: React.FC<UploadProps> = ({
uploadItemsWithCollection
.map(({ uploadItem }) => uploadItem)
.filter((x) => x !== undefined),
+ skippedFiles,
);
}
const batchResult = await uploadManager.uploadItems(
@@ -986,6 +1008,7 @@ export const Upload: React.FC<UploadProps> = ({
hasLivePhotos={hasLivePhotos}
retryFailed={retryFailed}
finishedUploads={finishedUploads}
+ skippedFiles={skippedFiles}
cancelUploads={cancelUploads}
/>
<CanvasReadbackBlockedDialog
@@ -1033,17 +1056,34 @@ const Inputs: React.FC<InputsProps> = ({
const desktopFilesAndZipItems = async (electron: Electron, files: File[]) => {
const fileAndPaths: FileAndPath[] = [];
let zipItems: ZipItem[] = [];
+ let skippedFiles: SkippedFile[] = [];
for (const file of files) {
const path = electron.pathForFile(file);
+
+ if (file.name.startsWith(".")) {
+ skippedFiles.push({ name: file.name, type: "hiddenFile" });
+ continue;
+ }
+
if (file.name.endsWith(".zip")) {
- zipItems = zipItems.concat(await electron.listZipItems(path));
+ try {
+ const result = await electron.listZipItems(path);
+ zipItems = zipItems.concat(result.items);
+ skippedFiles = skippedFiles.concat(result.skippedFiles);
+ } catch (e) {
+ // IPC failure (desktop returns malformed zips as part of
+ // the response, so reaching this catch means something
+ // more fundamental went wrong).
+ log.error("Failed to list zip items", e);
+ skippedFiles.push({ name: file.name, type: "failedZip" });
+ }
} else {
fileAndPaths.push({ file, path });
}
}
- return { fileAndPaths, zipItems };
+ return { fileAndPaths, zipItems, skippedFiles };
};
/**
@@ -1172,6 +1212,7 @@ const setPendingUploads = async (
electron: Electron,
collections: Collection[],
uploadItems: UploadItem[],
+ skippedFiles: SkippedFile[],
) => {
let collectionName: string | undefined;
/* collection being one suggest one of two things
@@ -1201,7 +1242,12 @@ const setPendingUploads = async (
}
}
- await electron.setPendingUploads({ collectionName, filePaths, zipItems });
+ await electron.setPendingUploads({
+ collectionName,
+ filePaths,
+ zipItems,
+ skippedFiles,
+ });
};
type UploadTypeSelectorProps = ModalVisibilityProps & {
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index d14e23607e..3fa9ec208a 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -397,6 +397,10 @@
"live_photos_detected": "The photo and video files from your Live Photos have been merged into a single file",
"ignored_uploads": "Ignored uploads",
"ignored_uploads_hint": "Skipped these as there are files with matching name and content in the same album",
+ "hidden_files": "Hidden files",
+ "hidden_files_hint": "These files were skipped because their names begin with a dot (e.g. system files)",
+ "unreadable_zip_files": "Unreadable zip files",
+ "unreadable_zip_files_hint": "These files have a .zip extension but could not be opened as zip archives, so their contents were not uploaded",
"file_not_uploaded_list": "The following files were not uploaded",
"failed_uploads": "Failed uploads",
"failed_uploads_hint": "There will be an option to retry these when the upload finishes",
diff --git a/web/packages/base/types/ipc.ts b/web/packages/base/types/ipc.ts
index 795ae3d239..b24b9164b8 100644
--- a/web/packages/base/types/ipc.ts
+++ b/web/packages/base/types/ipc.ts
@@ -626,9 +626,15 @@ export interface Electron {
* whose file name begins with a dot (i.e. "hidden" files) will also be
* excluded.
*
+ * Alongside `items`, the result includes `skippedFiles`: the hidden
+ * entries excluded above, plus a single entry for the zip itself if it
+ * could not be opened.
+ *
* To read the contents of the files themselves, see [Note: IPC streams].
*/
- listZipItems: (zipPath: string) => Promise<ZipItem[]>;
+ listZipItems: (
+ zipPath: string,
+ ) => Promise<{ items: ZipItem[]; skippedFiles: SkippedFile[] }>;
/**
* Return the size in bytes of the file at the given path or of a particular
@@ -879,6 +885,11 @@ export interface FolderWatchSyncedFile {
*/
export type ZipItem = [zipPath: string, entryName: string];
+export interface SkippedFile {
+ name: string;
+ type: "hiddenFile" | "failedZip";
+}
+
/**
* State about pending and in-progress uploads.
*
@@ -906,6 +917,11 @@ export interface PendingUploads {
* {@link ZipItem} (zip path and entry name) that need to be uploaded.
*/
zipItems: ZipItem[];
+ /**
+ * Files that were skipped because either we could not open them (zip files)
+ * or they are hidden dot files.
+ */
+ skippedFiles?: SkippedFile[];
}
/**
diff --git a/web/packages/gallery/components/UploadProgress.tsx b/web/packages/gallery/components/UploadProgress.tsx
index c4b02cbb3f..b1fbdbbcdd 100644
--- a/web/packages/gallery/components/UploadProgress.tsx
+++ b/web/packages/gallery/components/UploadProgress.tsx
@@ -30,7 +30,9 @@ import {
import { SpacedRow } from "ente-base/components/containers";
import { FilledIconButton } from "ente-base/components/mui";
import { useBaseContext } from "ente-base/context";
+import { basename } from "ente-base/file-name";
import { formattedListJoin } from "ente-base/i18n";
+import type { SkippedFile } from "ente-base/types/ipc";
import { t } from "i18next";
import memoize from "memoize-one";
import React, {
@@ -60,6 +62,7 @@ interface UploadProgressProps {
inProgressUploads: InProgressUpload[];
uploadFileNames: UploadFileNames;
finishedUploads: SegregatedFinishedUploads;
+ skippedFiles?: SkippedFile[];
hasLivePhotos: boolean;
cancelUploads: () => void;
}
@@ -111,6 +114,7 @@ export const UploadProgress: React.FC<UploadProgressProps> = ({
hasLivePhotos,
inProgressUploads,
finishedUploads,
+ skippedFiles = [],
cancelUploads,
}) => {
const { showMiniDialog } = useBaseContext();
@@ -158,6 +162,7 @@ export const UploadProgress: React.FC<UploadProgressProps> = ({
inProgressUploads,
uploadFileNames,
finishedUploads,
+ skippedFiles,
hasLivePhotos,
expanded,
setExpanded,
@@ -183,6 +188,7 @@ interface UploadProgressContextT {
inProgressUploads: InProgressUpload[];
uploadFileNames: UploadFileNames;
finishedUploads: SegregatedFinishedUploads;
+ skippedFiles: SkippedFile[];
hasLivePhotos: boolean;
expanded: boolean;
setExpanded: React.Dispatch<React.SetStateAction<boolean>>;
@@ -406,7 +412,7 @@ const clamp = (value: number, min: number, max: number) =>
Math.min(Math.max(value, min), Math.max(min, max));
const UploadProgressSubtitleText: React.FC = () => {
- const { uploadPhase, uploadCounter, finishedUploads } =
+ const { uploadPhase, uploadCounter, finishedUploads, skippedFiles } =
useUploadProgressContext();
return (
@@ -418,7 +424,12 @@ const UploadProgressSubtitleText: React.FC = () => {
marginTop: "4px",
}}
>
- {subtitleText(uploadPhase, uploadCounter, finishedUploads)}
+ {subtitleText(
+ uploadPhase,
+ uploadCounter,
+ finishedUploads,
+ skippedFiles,
+ )}
</Typography>
);
};
@@ -427,6 +438,7 @@ const subtitleText = (
uploadPhase: UploadPhase,
uploadCounter: UploadCounter,
finishedUploads: SegregatedFinishedUploads | null | undefined,
+ skippedFiles: SkippedFile[],
) => {
switch (uploadPhase) {
case "preparing":
@@ -442,7 +454,10 @@ const subtitleText = (
return t("upload_cancelling");
case "done": {
const count = uploadedFileCount(finishedUploads);
- const notCount = notUploadedFileCount(finishedUploads);
+ const notCount = notUploadedFileCount(
+ finishedUploads,
+ skippedFiles,
+ );
const items: string[] = [];
if (count) items.push(t("upload_done", { count }));
if (notCount) items.push(t("upload_skipped", { count: notCount }));
@@ -469,10 +484,12 @@ const uploadedFileCount = (
const notUploadedFileCount = (
finishedUploads: SegregatedFinishedUploads | null | undefined,
+ skippedFiles: SkippedFile[],
) => {
- if (!finishedUploads) return 0;
+ let c = skippedFiles.length;
+
+ if (!finishedUploads) return c;
- let c = 0;
c += finishedUploads.get("alreadyUploaded")?.length ?? 0;
c += finishedUploads.get("blocked")?.length ?? 0;
c += finishedUploads.get("failed")?.length ?? 0;
@@ -480,6 +497,7 @@ const notUploadedFileCount = (
c += finishedUploads.get("tooLarge")?.length ?? 0;
c += finishedUploads.get("unsupported")?.length ?? 0;
c += finishedUploads.get("zeroSize")?.length ?? 0;
+
return c;
};
@@ -504,19 +522,30 @@ const UploadProgressBar: React.FC = () => {
};
function UploadProgressDialog() {
- const { open, onClose, uploadPhase, finishedUploads } =
+ const { open, onClose, uploadPhase, finishedUploads, skippedFiles } =
useUploadProgressContext();
const [hasUnUploadedFiles, setHasUnUploadedFiles] = useState(false);
useEffect(() => {
- setHasUnUploadedFiles(notUploadedFileCount(finishedUploads) > 0);
- }, [finishedUploads]);
+ setHasUnUploadedFiles(
+ notUploadedFileCount(finishedUploads, skippedFiles) > 0,
+ );
+ }, [finishedUploads, skippedFiles]);
const handleClose: DialogProps["onClose"] = (_, reason) => {
if (reason != "backdropClick") onClose();
};
+ const skipped = (type: SkippedFile["type"]) =>
+ skippedFiles
+ .filter((file) => file.type == type)
+ .map(({ name }, index) => ({
+ key: `${type}-${index}-${name}`,
+ name: basename(name),
+ title: name,
+ }));
+
return (
<Dialog open={open} onClose={handleClose} maxWidth="xs" fullWidth>
<UploadProgressHeader />
@@ -561,6 +590,16 @@ function UploadProgressDialog() {
sectionTitle={t("insufficient_storage")}
sectionInfo={t("insufficient_storage_hint")}
/>
+ <FileNameListSection
+ items={skipped("hiddenFile")}
+ sectionTitle={t("hidden_files")}
+ sectionInfo={t("hidden_files_hint")}
+ />
+ <FileNameListSection
+ items={skipped("failedZip")}
+ sectionTitle={t("unreadable_zip_files")}
+ sectionInfo={t("unreadable_zip_files_hint")}
+ />
<ResultSection
resultType="unsupported"
sectionTitle={t("unsupported_files")}
@@ -707,45 +746,63 @@ const ResultSection: React.FC<ResultSectionProps> = ({
sectionInfo,
}) => {
const { finishedUploads, uploadFileNames } = useUploadProgressContext();
-
const fileList = finishedUploads.get(resultType);
if (!fileList?.length) {
return <></>;
}
- // @ts-expect-error Need to add types
- const renderListItem = (fileID) => {
- return (
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
- <ResultItemContainer key={fileID}>
- {uploadFileNames.get(fileID)}
- </ResultItemContainer>
- );
- };
+ return (
+ <FileNameListSection
+ items={fileList.map((fileID) => ({
+ key: fileID,
+ name: uploadFileNames.get(fileID)!,
+ }))}
+ sectionTitle={sectionTitle}
+ sectionInfo={sectionInfo}
+ />
+ );
+};
- // @ts-expect-error Need to add types
- const getItemTitle = (fileID) => {
- return uploadFileNames.get(fileID)!;
- };
+interface ResultSectionItem {
+ key: string | number;
+ name: string;
+ /**
+ * Tooltip text. Defaults to {@link name} if not provided.
+ */
+ title?: string;
+}
- // @ts-expect-error Need to add types
- const generateItemKey = (fileID) => {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
- return fileID;
- };
+interface FileNameListSectionProps {
+ items: ResultSectionItem[];
+ sectionTitle: string;
+ sectionInfo?: React.ReactNode;
+}
+
+const FileNameListSection: React.FC<FileNameListSectionProps> = ({
+ items,
+ sectionTitle,
+ sectionInfo,
+}) => {
+ if (!items.length) {
+ return <></>;
+ }
+
+ const renderListItem = (item: ResultSectionItem) => (
+ <ResultItemContainer>{item.name}</ResultItemContainer>
+ );
return (
<SectionAccordion>
<SectionAccordionSummary expandIcon={<ExpandMoreIcon />}>
- <TitleText title={sectionTitle} count={fileList.length} />
+ <TitleText title={sectionTitle} count={items.length} />
</SectionAccordionSummary>
<SectionAccordionDetails>
{sectionInfo && <SectionInfo>{sectionInfo}</SectionInfo>}
<ItemList
- items={fileList}
- generateItemKey={generateItemKey}
- getItemTitle={getItemTitle}
+ items={items}
+ generateItemKey={(item) => item.key}
+ getItemTitle={(item) => item.title ?? item.name}
renderListItem={renderListItem}
maxHeight={160}
itemSize={35}