Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web] Ignore nulls within the person's assigned array

Manav Rathi7e1f4a495b40
diff --git a/web/packages/new/photos/services/user-entity/index.ts b/web/packages/new/photos/services/user-entity/index.ts
index 099ed5887b..9e7f5eddbe 100644
--- a/web/packages/new/photos/services/user-entity/index.ts
+++ b/web/packages/new/photos/services/user-entity/index.ts
@@ -83,7 +83,15 @@ const RemoteFaceCluster = z.looseObject({
*/
const RemoteCGroupData = z.looseObject({
name: z.string().nullish().transform(nullToUndefined),
- assigned: z.array(RemoteFaceCluster).nullish().transform(nullishToEmpty),
+ // Accept nullish entries within the array and filter them out.
+ assigned: z
+ .array(RemoteFaceCluster.nullish())
+ .nullish()
+ .transform((arr) =>
+ (arr ?? []).filter(
+ (x): x is z.infer<typeof RemoteFaceCluster> => x != null,
+ ),
+ ),
rejectedFaceIDs: z.array(z.string()).nullish().transform(nullishToEmpty),
isHidden: z.boolean(),
avatarFaceID: z.string().nullish().transform(nullToUndefined),