Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: edit module mutation error #394

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions apps/app/components/modules/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,12 @@ export const CreateUpdateModuleModal: React.FC<Props> = ({ isOpen, setIsOpen, da
.then((res) => {
mutate<IModule[]>(
MODULE_LIST(projectId as string),
(prevData) => {
const newData = prevData?.map((item) => {
if (item.id === res.id) {
return res;
}
return item;
});
return newData;
},
(prevData) =>
prevData?.map((p) => {
if (p.id === res.id) return { ...p, ...payload };

return p;
}),
false
);
handleClose();
Expand Down
1 change: 1 addition & 0 deletions apps/app/components/modules/select/select-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const ModuleStatusSelect: React.FC<Props> = ({ control, error }) => (
</div>
}
onChange={onChange}
noChevron
>
{MODULE_STATUS.map((status) => (
<CustomSelect.Option key={status.value} value={status.value}>
Expand Down
14 changes: 6 additions & 8 deletions apps/app/components/modules/single-module-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ export const SingleModuleCard: React.FC<Props> = ({ module, handleEditModule })
<div className="flex h-full w-full flex-col items-start justify-between gap-6 p-5">
<div className="flex w-full flex-col gap-5">
<Tooltip tooltipContent={module.name} position="top-left">
<span
className="break-all text-xl font-semibold text-black"
>
<span className="break-all text-xl font-semibold text-black">
<Link href={`/${workspaceSlug}/projects/${module.project}/modules/${module.id}`}>
<a className="w-full">{truncateText(module.name, 75)}</a>
</Link>
Expand All @@ -186,19 +184,19 @@ export const SingleModuleCard: React.FC<Props> = ({ module, handleEditModule })
<div className="flex items-center gap-4">
<div className="flex items-start gap-1 ">
<CalendarDaysIcon className="h-4 w-4 text-gray-900" />
<span className="text-gray-400">Start :</span>
<span className="text-gray-400">Start:</span>
<span>{renderShortDateWithYearFormat(startDate)}</span>
</div>
<div className="flex items-start gap-1 ">
<div className="flex items-start gap-1">
<CalendarDaysIcon className="h-4 w-4 text-gray-900" />
<span className="text-gray-400">End :</span>
<span className="text-gray-400">End:</span>
<span>{renderShortDateWithYearFormat(endDate)}</span>
</div>
</div>
<div className="flex items-center gap-6">
<div className="flex items-center gap-1.5">
<UserCircleIcon className="h-5 w-5 text-gray-400" />
<span>Lead : </span>
<span>Lead:</span>
<div>
{module.lead_detail ? (
<div className="flex items-center gap-1">
Expand All @@ -221,7 +219,7 @@ export const SingleModuleCard: React.FC<Props> = ({ module, handleEditModule })
</div>
<div className="flex items-center gap-1.5">
<UserGroupIcon className="h-5 w-5 text-gray-400" />
<span>Members</span>
<span>Members:</span>
<div className="flex items-center gap-1 text-xs">
{module.members_detail && module.members_detail.length > 0 ? (
<AssigneesList users={module.members_detail} length={3} />
Expand Down
2 changes: 1 addition & 1 deletion apps/app/components/ui/custom-search-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type CustomSearchSelectProps = {
export const CustomSearchSelect = ({
label,
textAlignment,
height = "sm",
height = "md",
value,
onChange,
options,
Expand Down