From 6b0ef99036fce475efc588b72d0e9f7e9e7926d3 Mon Sep 17 00:00:00 2001 From: Liad Yosef Date: Wed, 21 Feb 2024 05:30:09 +0200 Subject: [PATCH] fix prop (#4930) Fixes an issue where the collaborators prop was not passed correctly --- utopia-remix/app/routes/projects.tsx | 73 ++++++++++++++++------------ 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/utopia-remix/app/routes/projects.tsx b/utopia-remix/app/routes/projects.tsx index 0b5f1f57afc4..d0d224d180c1 100644 --- a/utopia-remix/app/routes/projects.tsx +++ b/utopia-remix/app/routes/projects.tsx @@ -454,40 +454,49 @@ const CategoryTrashActions = React.memo(({ projects }: { projects: ProjectWithou }) CategoryTrashActions.displayName = 'CategoryTrashActions' -const ProjectCards = React.memo(({ projects }: { projects: ProjectWithoutContent[] }) => { - const selectedProjectId = useProjectsStore((store) => store.selectedProjectId) - const setSelectedProjectId = useProjectsStore((store) => store.setSelectedProjectId) +const ProjectCards = React.memo( + ({ + projects, + collaborators, + }: { + projects: ProjectWithoutContent[] + collaborators: CollaboratorsByProject + }) => { + const selectedProjectId = useProjectsStore((store) => store.selectedProjectId) + const setSelectedProjectId = useProjectsStore((store) => store.setSelectedProjectId) - const handleProjectSelect = React.useCallback( - (project: ProjectWithoutContent) => - setSelectedProjectId(project.proj_id === selectedProjectId ? null : project.proj_id), - [setSelectedProjectId, selectedProjectId], - ) + const handleProjectSelect = React.useCallback( + (project: ProjectWithoutContent) => + setSelectedProjectId(project.proj_id === selectedProjectId ? null : project.proj_id), + [setSelectedProjectId, selectedProjectId], + ) - return ( -
- {projects.map((project) => ( - handleProjectSelect(project)} - /> - ))} -
- ) -}) + return ( +
+ {projects.map((project) => ( + handleProjectSelect(project)} + collaborators={collaborators[project.proj_id]} + /> + ))} +
+ ) + }, +) ProjectCards.displayName = 'ProjectCards' const ProjectCard = React.memo(