mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: module and cycle sidebar date mutation fix (#2986)
This commit is contained in:
parent
25b7e22b70
commit
882cf91a91
@ -52,7 +52,10 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId, peekCycle } = router.query;
|
const { workspaceSlug, projectId, peekCycle } = router.query;
|
||||||
|
|
||||||
const { cycle: cycleDetailsStore, trackEvent: { setTrackElement, postHogEventTracker } } = useMobxStore();
|
const {
|
||||||
|
cycle: cycleDetailsStore,
|
||||||
|
trackEvent: { setTrackElement, postHogEventTracker },
|
||||||
|
} = useMobxStore();
|
||||||
|
|
||||||
const cycleDetails = cycleDetailsStore.cycle_details[cycleId] ?? undefined;
|
const cycleDetails = cycleDetailsStore.cycle_details[cycleId] ?? undefined;
|
||||||
|
|
||||||
@ -70,31 +73,7 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
const submitChanges = (data: Partial<ICycle>) => {
|
const submitChanges = (data: Partial<ICycle>) => {
|
||||||
if (!workspaceSlug || !projectId || !cycleId) return;
|
if (!workspaceSlug || !projectId || !cycleId) return;
|
||||||
|
|
||||||
mutate<ICycle>(CYCLE_DETAILS(cycleId as string), (prevData) => ({ ...(prevData as ICycle), ...data }), false);
|
cycleDetailsStore.patchCycle(workspaceSlug.toString(), projectId.toString(), cycleId.toString(), data);
|
||||||
|
|
||||||
cycleService
|
|
||||||
.patchCycle(workspaceSlug as string, projectId as string, cycleId as string, data)
|
|
||||||
.then((res) => {
|
|
||||||
mutate(CYCLE_DETAILS(cycleId as string));
|
|
||||||
postHogEventTracker(
|
|
||||||
"CYCLE_UPDATE",
|
|
||||||
{
|
|
||||||
...res,
|
|
||||||
state: "SUCCESS"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.catch((e) => {
|
|
||||||
console.log(e);
|
|
||||||
postHogEventTracker(
|
|
||||||
"CYCLE_UPDATE",
|
|
||||||
{
|
|
||||||
state: "FAILED"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCopyText = () => {
|
const handleCopyText = () => {
|
||||||
@ -337,11 +316,12 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
</button>
|
</button>
|
||||||
{!isCompleted && (
|
{!isCompleted && (
|
||||||
<CustomMenu width="lg" placement="bottom-end" ellipsis>
|
<CustomMenu width="lg" placement="bottom-end" ellipsis>
|
||||||
<CustomMenu.MenuItem onClick={() => {
|
<CustomMenu.MenuItem
|
||||||
|
onClick={() => {
|
||||||
setTrackElement("CYCLE_PAGE_SIDEBAR");
|
setTrackElement("CYCLE_PAGE_SIDEBAR");
|
||||||
setCycleDeleteModal(true)
|
setCycleDeleteModal(true);
|
||||||
}
|
}}
|
||||||
}>
|
>
|
||||||
<span className="flex items-center justify-start gap-2">
|
<span className="flex items-center justify-start gap-2">
|
||||||
<Trash2 className="h-3 w-3" />
|
<Trash2 className="h-3 w-3" />
|
||||||
<span>Delete cycle</span>
|
<span>Delete cycle</span>
|
||||||
|
@ -75,20 +75,7 @@ export const ModuleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
|
|
||||||
const submitChanges = (data: Partial<IModule>) => {
|
const submitChanges = (data: Partial<IModule>) => {
|
||||||
if (!workspaceSlug || !projectId || !moduleId) return;
|
if (!workspaceSlug || !projectId || !moduleId) return;
|
||||||
|
moduleStore.updateModuleDetails(workspaceSlug.toString(), projectId.toString(), moduleId, data);
|
||||||
mutate<IModule>(
|
|
||||||
MODULE_DETAILS(moduleId as string),
|
|
||||||
(prevData) => ({
|
|
||||||
...(prevData as IModule),
|
|
||||||
...data,
|
|
||||||
}),
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
moduleService
|
|
||||||
.patchModule(workspaceSlug as string, projectId as string, moduleId as string, data)
|
|
||||||
.then(() => mutate(MODULE_DETAILS(moduleId as string)))
|
|
||||||
.catch((e) => console.log(e));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCreateLink = async (formData: ModuleLink) => {
|
const handleCreateLink = async (formData: ModuleLink) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user