Skip to content

Commit

Permalink
fix: fetch selected project members (#741)
Browse files Browse the repository at this point in the history
* fix: fetch selected project members

* chore: remove old imports
  • Loading branch information
aaryan610 authored Apr 8, 2023
1 parent 0a3d137 commit beedd57
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions apps/app/components/integration/github/import-users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const GithubImportUsers: FC<Props> = ({ handleStepChange, users, setUsers
index={index}
users={users}
setUsers={setUsers}
project={watch("project")}
/>
))}
</div>
Expand Down
19 changes: 14 additions & 5 deletions apps/app/components/integration/github/single-user-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ import { useRouter } from "next/router";
import useSWR from "swr";

// services
import workspaceService from "services/workspace.service";
import projectService from "services/project.service";
// ui
import { Avatar, CustomSearchSelect, CustomSelect, Input } from "components/ui";
// types
import { IGithubRepoCollaborator } from "types";
import { IUserDetails } from "./root";
// fetch-keys
import { WORKSPACE_MEMBERS } from "constants/fetch-keys";
import { PROJECT_MEMBERS } from "constants/fetch-keys";

type Props = {
collaborator: IGithubRepoCollaborator;
index: number;
users: IUserDetails[];
setUsers: React.Dispatch<React.SetStateAction<IUserDetails[]>>;
project: string | null;
};

const importOptions = [
Expand All @@ -35,13 +36,21 @@ const importOptions = [
},
];

export const SingleUserSelect: React.FC<Props> = ({ collaborator, index, users, setUsers }) => {
export const SingleUserSelect: React.FC<Props> = ({
collaborator,
index,
users,
setUsers,
project,
}) => {
const router = useRouter();
const { workspaceSlug } = router.query;

const { data: members } = useSWR(
workspaceSlug ? WORKSPACE_MEMBERS(workspaceSlug as string) : null,
workspaceSlug ? () => workspaceService.workspaceMembers(workspaceSlug as string) : null
workspaceSlug && project ? PROJECT_MEMBERS(project) : null,
workspaceSlug && project
? () => projectService.projectMembers(workspaceSlug as string, project)
: null
);

const options =
Expand Down

1 comment on commit beedd57

@vercel
Copy link

@vercel vercel bot commented on beedd57 Apr 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-dev – ./apps/app

plane-dev.vercel.app
plane-dev-git-develop-caravel.vercel.app
plane-dev-caravel.vercel.app

Please sign in to comment.