π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Shortcircuit
Manav Rathi72842e8c3617
diff --git a/web/packages/new/photos/components/PeopleSelector.tsx b/web/packages/new/photos/components/PeopleSelector.tsxindex 8ed5138d45..78be8b99a8 100644--- a/web/packages/new/photos/components/PeopleSelector.tsx+++ b/web/packages/new/photos/components/PeopleSelector.tsx@@ -33,7 +33,7 @@ export const PeopleSelector: React.FC<PeopleSelectorProps> = ({const [openNameInput, setOpenNameInput] = useState(false);- const filteredCollections: CollectionSummary[] = [];+ const people: CollectionSummary[] = [];const handleAddPerson = () => {console.log("handleAddPerson");@@ -48,6 +48,27 @@ export const PeopleSelector: React.FC<PeopleSelectorProps> = ({console.log("handleAddPersonWithName", name);};+ // [Note: Calling setState during rendering]+ //+ // Calling setState during rendering should be avoided when there are+ // cleaner alternatives, but it is not completely verboten, and it has+ // documented semantics:+ //+ // > React will discard the currently rendering component's output and+ // > immediately attempt to render it again with the new state.+ // >+ // > https://react.dev/reference/react/useState++ // If we're opened without any existing people that can be selected, jump+ // directly to the add person dialog.+ //+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition+ if (open && !openNameInput && !people.length) {+ onClose();+ setOpenNameInput(true);+ return <></>;+ }+return (<><Dialog@@ -64,7 +85,7 @@ export const PeopleSelector: React.FC<PeopleSelectorProps> = ({</SpaceBetweenFlex><DialogContent_><AddPerson onClick={handleAddPerson} />- {filteredCollections.map((person) => (+ {people.map((person) => (<PersonButtonkey={person.id}person={person}@@ -115,7 +136,7 @@ const PersonButton: React.FC<PersonButtonProps> = ({const AddPerson: React.FC<ButtonishProps> = ({ onClick }) => (<ItemCard TileComponent={LargeTileButton} onClick={onClick}>- <LargeTileTextOverlay>{t("New person")}</LargeTileTextOverlay>+ <LargeTileTextOverlay>{pt("New person")}</LargeTileTextOverlay><LargeTilePlusOverlay>+</LargeTilePlusOverlay></ItemCard>);