Skip to content

Commit

Permalink
fix: useEffect editteamform dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Irere123 committed Nov 12, 2024
1 parent 19edc40 commit c750643
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/components/projects/edit-team-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function EditTeamForm({
}, [state]);

return (
<div className="flex flex-col space-y-4 bg-gray-50 px-4 py-8 md:px-16">
<div className="flex flex-col space-y-4 py-8">
<form action={formAction}>
<div className="relative">
<input
Expand Down Expand Up @@ -206,7 +206,7 @@ const EditTeamFormPseudo = ({
toast({ description: "Project updated successfully" });
});
}
});
}, [state]);

return (
<form action={formAction}>
Expand All @@ -223,5 +223,9 @@ const EditTeamFormPseudo = ({

const FormButton = () => {
const { pending } = useFormStatus();
return <Button disabled={pending}>Save changes</Button>;
return (
<Button disabled={pending} type="submit">
Save changes
</Button>
);
};
4 changes: 2 additions & 2 deletions src/modules/actions/select-team-member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FormResponse, selectUserSchema } from "./utils";
import { authUser } from "./auth";
import { db } from "@/db";
import { users } from "@/db/schema";
import { eq } from "drizzle-orm";
import { eq, ilike, or } from "drizzle-orm";
import { ZodError } from "zod";

export async function selectTeamMember(
Expand All @@ -20,7 +20,7 @@ export async function selectTeamMember(
const [user] = await db
.select()
.from(users)
.where(eq(users.name, name))
.where(or(eq(users.name, name), ilike(users.email, `%${name}%`)))
.limit(1);

if (!user) {
Expand Down

0 comments on commit c750643

Please sign in to comment.